how sensex and nifty works