## main

n = gets.strip.to_i
m = gets.strip.to_i

n2 = n * 2
cards = (1..n2).to_a

m.times do
  k = gets.strip.to_i

  if k == 0
    c0 = (0...n).map{|i| cards[2 * i]}
    c1 = (0...n).map{|i| cards[2 * i + 1]}
    cards = c0 + c1
  else
    c0 = cards[0...k]
    c1 = cards[k...n2]
    cards = c1 + c0
  end
end

for c in cards
  puts c
end