The right two-part question to ask is:
a) can you know in advance whether or not the S&P 500 is going to be flat and can you know in advance for how long
b) can you pick, in advance, an investment or portfolio of investments that you can be more confident about will have a higher risk-adjusted rate of return for said period.
The natural answer is no. Firstly, you don't know in advance how long the index will be stagnant (if at all) or for how long and you cannot know with high certainty which investments will outperform on a risk-adjusted basis for an unknown period of time.
I like to remind people, "the index CAN be over-priced," and most just shrug their shoulders at me.