The S&P 500 recently reached a fresh all-time high, and we're officially in a bull market once again. However, that doesn't mean that all stocks are now "expensive."

While some stocks certainly are trading at elevated valuations, others still look like bargains. Here are two that I'm planning to buy shares of this year, and that could have market-beating potential for years to come.

A great income stock in any environment

Realty Income (O -0.17%) has rebounded significantly from its October 2023 lows but is still trading at a big discount to its historical valuation levels. But this real estate investment trust (REIT) and its 5.5%-yielding monthly dividend could be a great opportunity for patient long-term investors.

If you aren't familiar with the business, Realty Income owns a portfolio of more than 13,250 properties, most of which are occupied by single tenants in retail or service businesses. It focuses on tenants that have recession-resistant qualities and don't have to worry much about competition from e-commerce. Tenants sign long-term leases with annual rent increases built in, so all Realty Income needs to do is acquire real estate with excellent tenants in place and enjoy years of predictable, growing income.

Additionally, Realty Income has A-rated credit, which gives it access to relatively cheap capital, even in a high-interest-rate environment. For example, Realty Income just issued new debt to help fund its Spirit Realty Capital acquisition, at a weighted average interest rate of less than 5%.

The long-term numbers show just how powerful its compound growth model can be. Even with its underperformance in the rising-interest-rate environment over the past two years, Realty Income has delivered a 13.4% annualized total return since it went public in 1994, handily outperforming the S&P 500. It has increased its dividend payouts on 123 occasions since then, with no cuts, and has done a great job of creating value for investors in a variety of market environments. Plus, since REITs are highly rate-sensitive stocks in general, Realty Income could get a nice tailwind if interest rates start to ease in 2024.

Small-cap valuations are still cheap

You may have seen the phrase "Magnificent Seven" in the headlines recently -- it refers to the seven largest tech stocks in the S&P 500, a group that has accounted for a disproportionate share of the market's strong performance in the past year.

While this is certainly true, it isn't just the megacaps that were outperforming. The S&P 500 as a whole has outperformed the small-cap Russell 2000 index by 38 percentage points over the last three years. But this could be a pivotal year, and the Vanguard Russell 2000 ETF (VTWO 0.97%) could be a great way to play it. In fact, Fundstrat analyst Tom Lee has called small caps his top investment idea of 2024, and predicts that the Russell 2000 could potentially rise by 50% or more this year alone.

^RUT Chart

^RUT data by YCharts.

There are a few potential catalysts that could cause that to happen. Falling interest rates (and the Fed is widely expected to cut them somewhat this year) would lead to lower borrowing costs, potentially increasing investors' appetite for risk. A stronger economy could also help narrow the valuation gap, as small caps tend to be more sensitive to things like recession fears.

The last time the Russell 2000's price-to-book valuation was this discounted compared to the S&P 500 was 25 years ago, and that period was followed by more than a decade of small-cap outperformance.

Two great long-term investments

To be perfectly clear, while I think both of these investments have a great chance of outperforming the S&P 500 in 2024, I also think they make excellent long-term holdings, regardless of what happens this year. Realty Income was actually the first REIT I ever bought, and I've continued to build my position in it for more than a decade. And although small caps have underperformed lately, the Russell 2000 index has a long-term record of producing strong returns for investors.