Marks and Spencer enjoyed a positive food performance despite the UK retailer recording a drop in first-half profit.