The past year has been one of the most painful periods in recent memory for retirement savers. The only good news is these downturns historically have been the ideal time to put money to work in the market.

Stocks won't stay down forever, and there are some compelling deals right now. If you have $500 that you don't need for important things like paying bills, building up an emergency fund, and/or lowering your short-term debt, there are two stocks you might want to consider buying that offer great value relative to their future earnings power and could outperform the broader market averages over the next few years. Let's find out a bit more about these two long-term investment options.

1. RH: A furniture store with software margins  

Shares of RH (formerly Restoration Hardware) (RH -0.85%) were hit hard in the current bear market. Market traders are worried about a slowing housing market and the potential impact on the sale of home furnishings. RH reported relatively flat revenue growth last quarter, so the concerns were valid. Because of this, long-term investors now have a great opportunity to buy an emerging top retail brand at a valuation that was unthinkable just a few years ago when sales were booming.

What is getting overlooked by the market is that RH managed to improve its gross margin by 350 basis points last quarter. Management is doing what it can to keep its profits up by not going overboard on discounting to boost sales. While this practice lowers sales in a slow economy, it protects the value of the brand from the death spiral of a promotional sales model, which can destroy profits over the long term.

It's also a great sign that Warren Buffett's Berkshire Hathaway owns a small stake in the company, and Berkshire bought even more shares in the third quarter. RH is the type of business that would appeal to Buffett or one of his investing deputies. RH CEO Gary Friedman has built a top-tier brand in a highly competitive industry, and the company now has industry-leading margins to boot. The company's operating margin registered at a high 24% over the last year, exceeding the industry average of 16%. 

RH Operating Margin (TTM) Chart

RH Operating Margin (TTM) data by YCharts

While the company will struggle to grow sales in the near term, it is generating positive free cash flow which is funding its global expansion. Next year, RH plans to open new galleries in the U.K. and Palo Alto, Calif. 

The stock nearly tripled in value over the last five years, even after the recent dip. At a low forward price-to-earnings (P/E) ratio of 11.5, which is about half the P/E of the S&P 500 index, the stock trades at a massive discount to what it's really worth and offers great return prospects.

2. VF: An undervalued collection of top apparel brands

VF Corp. (VFC 2.88%) is one of the largest apparel companies in the world. It has a long history of managing top brands, including Vans, Timberland, The North Face, and most recently through acquisition, the popular streetwear brand Supreme. 

After a strong year of growth coming out of the pandemic, sky-high inflation took its toll on the company's financials. Revenue was down 1% year over year through the first half of the year, with solid growth at The North Face and other brands offset by declines at Vans and Dickies. As a result of weak growth, the stock price is down 55% this year, which presents an excellent buying opportunity ahead of management's long-term growth objectives. 

By fiscal 2027, management is targeting annualized revenue growth in the mid- to high-single-digit range. Most importantly, its strategy calls for faster growth in earnings per share up to the low double-digit range. Growing profits around 10% per year more than justifies the stock's P/E of 13.7 based on this year's earnings estimates. 

How is management going to accomplish these targets? The company narrowed its brand portfolio from over 30 brands down to 12, with the remaining brands targeting markets that are experiencing the most demand, such as outdoor activities, work, and streetwear. It's also implementing automation solutions at its distribution centers to lower costs and boost profitability.  

Another reason to like VF is its generous capital return program. The stock currently pays a high dividend yield of 4.54%, and management plans to return about $7 billion to shareholders through dividends and share repurchases over the next five years. That amount represents more than half of the company's current market cap (stock price times total shares outstanding), which signals a bargain.