Bill Ackman of Pershing Square Capital Management and Andreas Halvorsen of Viking Global Investors are two billionaires worth following for investment ideas. They are entrusted with billions in assets to manage for clients, and that reflects a career of making smart investment choices.

Alphabet (GOOG -0.26%) (GOOGL -0.25%) and Salesforce (CRM -0.23%) are two stocks these firms held in the second quarter. Both companies have solid growth prospects due to their investment in artificial intelligence (AI). If you have $500 to invest after paying expenses or any debt, you can easily afford one share of each stock. Here's why these are solid choices to invest in AI right now.

1. Alphabet

Bill Ackman's Pershing Square has held a position in Google parent Alphabet since the first quarter of 2023. The stock was trading at a cheaper valuation when the firm originally bought the shares, but relative to the company's solid growth prospects in the AI era, the shares still offer attractive upside.

Alphabet has a lot of irons in the fire, including Google Cloud and its Waymo self-driving car unit, but online advertising is Google's main source of revenue, and it's growing at a nice rate.

Revenue grew 15% year over year in the third quarter to $88 billion, driven mostly by growth in Google Search, subscriptions, devices, and YouTube ads. New search features like AI Overviews are creating more ways for people to search. This is increasing user engagement and could benefit Google's ad revenue over the long term.

Google's investments in AI, such as its Gemini AI models, are making the company's products more useful for people and improving the company's growth prospects. This is most evident with Google Cloud, where revenue grew 35% over the year-ago quarter. Google Cloud offers tools that help companies build generative AI applications -- a segment of the AI market that is expected to grow substantially in the coming years.

While Pershing Square sold some shares in the second quarter, I believe it's still one of the most undervalued large-cap tech stocks. The shares trade at a forward price-to-earnings ratio (P/E) of 22, which looks very attractive against consensus estimates forecasting Alphabet's earnings to grow at a compound annual rate of 16%.

2. Salesforce

Viking Global holds a diversified portfolio of dozens of stocks, and one of its new buys in the second quarter was Dow Jones member Salesforce. Shares of the customer relationship management (CRM) software provider are up 18% year to date at the time of this writing.

Salesforce software helps a company's employees get things done faster, including chasing sales leads, marketing, customer service, and more. The company consistently posted top-line growth of over 20% annually until macroeconomic headwinds in 2022 caused growth to slow across the enterprise software market.

It hasn't been the same high-growth company the last few years. Revenue increased just 8% year over year in the second quarter, but as the company incorporates AI across its software, it could see improving growth.

The appeal for businesses is improved employee productivity, which seems to be an ideal opportunity for the leading CRM provider. Salesforce has invested heavily in the technology, including Agentforce, an AI-powered assistant that can automate tasks and retrieve information.

Despite the stock's recent run, the valuation still looks compelling. The shares trade at a forward P/E of 31, which seems reasonable relative to growth expectations. Analysts forecast the company's earnings to grow at an annualized rate of 16% over the long term, which is enough to potentially double the share price in five years assuming the stock continues to trade at the same valuation.

There is a lot of opportunity for growth in the CRM market, which is expected to reach a value of $145 billion by 2029, according to Statista. Salesforce has a lot of upside in this market with only $36 billion in trailing revenue. The shares are a great buy-and-hold investment.