### 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 = []
    for i in (0...n)
      c0[2 * i] = cards[i]
      c0[2 * i + 1] = cards[n + i]
    end
    cards = c0
  else
    c0 = cards[0...k]
    c1 = cards[k...n2]
    cards = c1 + c0
  end
end

for c in cards
  puts c
end