General Motors (GM) Interview Question

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