The key indices, Sensex and Nifty 50, ended lower on 5 May, driven by profit-taking. Mid- and small-cap stocks showed gains.