Investing in fundamentally sound stocks is a smart way to build wealth in the long run. By focusing on companies with robust and scalable business models, healthy financials, sustainable competitive advantages, and reasonable valuations, investors can enjoy significant returns over time.

The S&P 500 and the Nasdaq Composite indexes have gained nearly 32.3% and 38.9%, respectively, in the past 12 months. Despite this, there are still several attractively valued stocks that have the potential to grow rapidly in the coming years.

If you're on the lookout for such stocks and have $500 that you won't require for paying bills or for contingencies, then investing those funds in either Baidu (BIDU 0.62%) or Toast (TOST 3.42%) could prove to be a profitable strategy in the long run.

The case for Baidu

Baidu operates the leading search engine in China, but its shares have been struggling for the past couple of years. The company faces risks such as increasing competition, weakness in the Chinese economy, and U.S. export restrictions that are making it harder for Chinese companies to secure high-end AI GPUs. Yet, there remains much to like in the stock in the long run.

In 2024, the Chinese digital advertising market is expected to grow by 8.9% to $189 billion. Search advertising is the largest part of this market, and is forecast to reach $60.8 billion this year. Given that Baidu controls a nearly 60% share of the Chinese search engine market, it is well positioned to capture a significant portion of this opportunity.

To further strengthen its position in search advertising, Baidu has leveraged generative AI technologies and advanced natural language capabilities to develop "Ernie," a generative AI model and chatbot. This technology has been playing a pivotal role in generating incremental revenues with improved ad targeting and bidding. Ernie is also helping advertisers articulate their requirements through a conversational interface, to optimize search and feed personalized content to ad campaigns. These initiatives have led to Baidu witnessing an increase in the number of advertisers on its platform, and also growth in their ad budget allocations.

Baidu's cloud business is another key catalyst for the company. It expects its overall cloud business revenues to accelerate in 2024. Management has expressed confidence in its ability to improve the gross margins of its legacy enterprise cloud business and maintain the profitability of the AI cloud business in 2024. The integration of generative AI and foundational models into the cloud business has enabled Baidu to win customers and projects in the internet, technology, and education sectors.

Despite these growth drivers, Baidu is currently trading at only 2 times trailing 12-month sales, even lower than its five-year average price-to-sales ratio of 3.07. The market currently has a pessimistic view of the stock that does not seem justified.

Hence, considering the multiple secular tailwinds driving the business and its cheap valuation, there is a high possibility that the stock will make a solid comeback in the coming years.

The case for Toast

Toast offers a comprehensive cloud-based software-as-a-service platform to help restaurants streamline activities including online ordering, logistics management for food delivery, accounting, marketing, and loyalty programs -- thereby enhancing their operations and boosting their growth potential.

Toast's offerings are being rapidly adopted in the restaurant industry thanks to its competitive advantages, including an all-in-one platform, localized go-to-market strategy, and the consistently solid performances of its sales and marketing teams. The company added a net 6,500 restaurant locations in the fourth quarter and ended 2023 with approximately 106,000 locations, up 34% on a year-over-year basis.

Currently, there are 860,000 restaurant locations in the U.S. and 22 million locations in the world. Toast has estimated its U.S. target addressable market to be $55 billion, and the global target addressable market to be $110 billion. Given that its annual recurring revenue is just $1.2 billion, there is still a massive runway of possible growth ahead for the company. While high-value full-service restaurants have been the foundation of Toast's success, the company is also seeing significant traction in other areas such as small and medium-sized businesses (SMBs), mid-market enterprise and international segments, and restaurant retail.

Toast has also been successful in efficiently acquiring new SMB customers through referrals and inbound leads in markets where it already has a higher penetration rate (over 20% SMB market share in that area). It describes those areas as "flywheel markets." In 2023, Toast almost doubled the number of its flywheel markets, and nearly 30% of the company's markets are now in that category. These flywheel markets should continue to help boost the company's revenues and margins.

Toast is not yet profitable on a GAAP basis. However, it is moving in the right direction. In 2023, it reported a net loss of $36 million, a significant improvement from its $99 million loss in 2022. The company also delivered a free cash flow of $93 million in 2023.

Analysts expect Toast's revenues to grow 25% to $4.8 billion in 2024. Despite this, the company is trading at only 3.3 times trailing 12-month sales, even lower than its 3-year average price-to-sales ratio of 4.9.

Considering all these points, Toast could soar in the coming years.