require "pp"
def rifuru(cards)
  c = []
  n = cards.size
  n.times do |i|
    c << cards[(n / 2) * (i % 2) + i / 2]
  end
  c
end

def cut(cards, k)
  n = cards.size
  top = cards.slice(0, k)
  buttom = cards.slice(k, n - k)
  c = []
  buttom.each { |num| c << num }
  top.each { |num| c << num }
  c
end

n = STDIN.readline.chomp.to_i
m = STDIN.readline.chomp.to_i

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

m.times do
  k = STDIN.readline.chomp.to_i
  if k == 0
    cards = rifuru(cards) 
  else
    cards = cut(cards, k)
  end
end

cards.each do |num|
  puts num
end