def g;gets.split.map(&:to_i)end n,_=g a=*1..n g.each{|i|a.unshift a.delete_at(i-1)} p a[0]