Can anyone help me understand as to why in CAPM's market portfolio investors will always have the assets in proportion to the market value? One of the intuitive reasonings that I have read explains that since the odds of finding over-valued and under-valued stocks in a CAPM world as random, rational investors will have not gain anything by overweighing or underweighting any sector. I, however, am unable to understand why would they choose the market values of the asset (and not some other factor, say the riskiness of the asset) as the weights of the respective assets.
Kindly help me in understanding as to why the market value of the asset would be the optimum metric to weigh the assets in the market portfolio. Any help would be highly appreciated.