I have two vectors x and y. 
    x = c(2, 4, 6, 3, 1.5)
    y = c(2.2, 1, .5)
    m = matrix(c(x, y, rep(0, length(x)), rep(1, length(y))), 
    nrow = 2, ncol= length(x) + length(y), byrow = TRUE)
How can I sort the second row of matrix m according to sort of first row of matrix min R?
    > res
   [1] 1 1 0 0 1 0 0 0
 
     
    