The past year was a rough one for the stock market, with the S&P 500 falling 19.4% in 2022. But the result of this downturn is that investors now have some attractive stock-buying opportunities.

For instance, share prices of Viatris (VTRS -0.40%), General Motors (GM -0.60%), and Delta Air Lines (DAL -1.48%) all declined by double-digit percentages in 2022 and the stocks are trading at significant discounts.

Let's take a closer look at these three cheap S&P 500 stocks and see if we can determine whether you should consider buying them right now.

1. Viatris

Viatris, a maker of generic and branded drugs, hasn't been getting much love despite performing reasonably well over the past year. Net income in the trailing 12 months has totaled $803.6 million on revenue of $16.7 billion. During that time, the company also generated free cash flow of $2.8 billion.

In 2022, Viatris' stock fell 17.7% and only slightly outperformed the S&P 500. Investors continue to discount this stock as it trades at a forward price-to-earnings (P/E) multiple of only 3. The stock isn't even trading near the company's book value; Viatris' price-to-book multiple is 0.7.

A big reason for the price drop is that investors are worried about its debt (which totals $20.3 billion). Viatris management has made efforts to pay that down in recent quarters, and late last year the company announced the completion of the sale of its biosimilars business. The sale included a $2 billion cash payment that will help strengthen its financial position. As of Sept. 30, Viatris reported cash and short-term investments of $977.8 million.

The concern over debt is somewhat warranted, but the company is performing well and making efforts to get debt under control. With the stock trading at a cheap earnings multiple, this could be an underrated healthcare stock to buy in 2023.

2. General Motors

Last year was a tough one for automaker General Motors; its share price tanked 43%. At a forward P/E of more than 5, this stock isn't much more expensive than Viatris, and there are multiple reasons investors are discounting it right now.

One cause for concern is rising interest rates and a worsening economy makes it harder for car buyers to afford vehicle financing, which could put a strain on the company's top line. And yet, for the nine-month period ending Sept. 30, GM's revenue totaled $113.6 billion, which was 22% higher than the $93.4 billion it reported during the same stretch in 2021.

Another concern for investors to consider is the rising popularity of electric and self-driving vehicles. Electric car maker Tesla has struggled of late, and rival Ford Motor Company gave up on making fully autonomous vehicles, incurring a massive $2.7 billion writedown in the process. Getting into autonomous vehicles sounds like a great growth opportunity, but it can also be an incredibly costly one, and investors might be worried that GM will follow in Ford's footsteps.

The upside is that General Motors remains a top name in the automotive industry, and while 2023 might be a challenging year for the business, the company's financials have been reasonably strong and could absorb the impact of a worsening market. Over the past four quarters, General Motors reported a profit of $8.6 billion on sales of $147.2 billion.

Given the company's relatively low valuation, GM's stock might be a good contrarian pick this year, as a feared recession in 2023 could end up being a mild one, according to some analysts.

3. Delta Air Lines

The best-performing stock on this list is Delta Air Lines, which declined a relatively modest 16%. And while 2022 wasn't a great year for the airline industry amid rising oil prices, better days lie ahead. The International Air Transport Association (IATA) projects that this year, the industry will report a profit of $4.6 billion after three straight years of losses due to the pandemic.

Trading at just 6 times future profits, Delta's stock is the most expensive one on this list -- and that's still cheap compared to the S&P 500 average of 17. Delta has squeaked out a profit over its past four quarters, with net income of $81 million representing a less-than-1% profit on the $46.6 billion in revenue it reported during that time frame. And with oil prices coming down, Delta's profitability should improve in future quarters. Demand for air travel is still strong despite inflation, a trend that IATA clearly expects will continue in 2023.

Delta is offering its pilots raises of 34%, which could help the company attract pilots and put it in a better position than its rivals to meet travel demand and minimize interruptions.

The airline industry is on more solid footing today, and so is Delta. The airline's stock is at a low valuation and is one of the better S&P 500 stocks to buy right now.