Stock market ending the second week of May in gain