Sort two sorted arrays in place

O(M+N^2) solution, where M is the number of elements in first array and
N in second array.