Most experts say individuals in the workforce should save 15% of their annual income for retirement. For context, the median full-time worker in the United States earned $56,287 in 2020, according to the Census Bureau. That means the median worker should be saving about $8,445 each year, or $162 each week if they have any chance of becoming a stock market millionaire.

Of course, half of the population makes less money than the median worker. Fortunately, it is still possible to become a stock market millionaire with less than $162 per week. The only prerequisite is a long-term mindset.

Here are two index funds that could help you build a $1 million portfolio.

1. Vanguard S&P 500 ETF

The Vanguard S&P 500 ETF (VOO -0.23%) tracks the S&P 500, an index comprising 500 of the largest U.S. companies. The ETF is weighted most heavily toward the information technology (27.3%), healthcare (14.1%), and consumer discretionary (11.4%) sectors, though its holdings span all 11 market sectors. That makes it a good choice for investors who prefer a diversified blend of value stocks and growth stocks.

Over the past decade, the Vanguard S&P 500 ETF generated a total return of 202%, which is the same as 11.7% per year. At that pace, $100 invested on a weekly basis would grow into a $1 million portfolio in 29 years, and it would grow into a $2 million portfolio in 35 years.

The chart below illustrates how different weekly contributions would grow over one, two, and three decades, assuming an 11.7% annualized rate of return.

Savings

$50 per week

$100 per week

$150 per week

10 years

$47,600

$95,200

$142,800

20 years

$191,500

$383,000

$574,600

30 years

$626,500

$1.3 million

$1.8 million

Data source: YCharts. Note: estimates assume an annualized return of 11.7%.

As a caveat, there is no guarantee the Vanguard S&P 500 ETF will generate an annualized return of 11.7% in the coming decades -- the S&P 500 generated a total annualized return of 9.7% over the last three decades. But even at that pace, $100 invested on a weekly basis would grow into a $1 million portfolio in 32 years, and it would grow into a $2 million portfolio in 39 years.

As a final thought, the Vanguard S&P 500 ETF bears an expense ratio of 0.03%, meaning an investor would pay just $3 per year on a $10,000 portfolio.

2. Invesco QQQ Trust

The Invesco QQQ Trust (QQQ -0.57%) tracks the Nasdaq 100, an index that comprises 100 of the largest U.S. and international companies. The Invesco QQQ Trust's holdings span just seven of the 11 market sectors, and the index fund is heavily weighted toward the information technology (49.3%), consumer discretionary (16.4%), and communications services (15.9%) sectors. That means it is much less diversified than the Vanguard S&P 500 ETF, which makes it a great option for investors looking for high exposure to tech stocks and growth stocks.

Over the last decade, the Invesco QQQ Trust generated an astonishing total return of 300%, which is the same as 14.9% per year. At that pace, $100 invested on a weekly basis would grow into a $1 million portfolio in just 24 years, and it would grow into a $2 million portfolio in 29 years.

The chart below illustrates how different weekly contributions would grow over one, two, and three decades, assuming a 14.9% annualized rate of return.

Savings

$50 per week

$100 per week

$150 per week

10 years

$56,400

$112,800

$169,200

20 years

$282,700

$565,400

$848,200

30 years

$1.1 million

$2.3 million

$3.5 million

Data source: YCharts. Note: estimates assume an annualized return of 14.9%.

As a caveat, while the Invesco QQQ Trust did achieve an annualized return of 14.9% over the past decade, there is no guarantee that trend will continue. The highly concentrated nature of the index fund means it can be very volatile at times, which can cause returns to fluctuate dramatically. For instance, the Invesco QQQ Trust generated an annualized return of just 7.3% since its inception in 1999, due in large part to the market crash associated with the dot-com bubble. But even at that pace, $100 invested on a weekly basis would grow into a $1 million portfolio in 40 years.

As a final thought, the Invesco QQQ Trust bears an expense ratio of 0.2%, meaning investors would pay $20 per year on a $10,000 portfolio.

The secret to becoming a stock market millionaire

Investors who want to earn a fortune in the stock market must remember this rule: It is time in the market -- not timing the market -- that matters. No one knows with absolute certainty whether the S&P 500 or the Nasdaq 100 will rise or fall over the next month or year. But both indexes have generated tremendous wealth over long periods of time. That means it is essential to invest on a regular basis, whether the stock market is rising or falling. In fact, bear markets are the best time to buy stocks.