General Motors (GM) interview question

Sort an array with N element in M+N array. To use O(1) space and memory.