def cut!(cards,k)
  n = cards.length
  sub_cards = cards.slice(0,k)
  j = n-k
  0.upto(j) do |i|
    cards[i] = cards[k+i]
  end
  j.upto(n-1) do |i|
    cards[i] = sub_cards[i-j]
  end
end

def shaffle!(cards)
  n = cards.length
  half = n/2
  sub_a = cards.slice(0,half)
  sub_b = cards.slice(half,half)
  0.upto(n-1) do |i|
    cards[i] = i.even? ? sub_a[i/2] : sub_b[i/2]
  end
end

n = gets.to_i * 2 # カードの枚数をnとする
m = gets.to_i
ops = Array.new(m) {gets.to_i}
cards = Array.new(n) {|i| i+1} # 上からi番目にカードa[i]がある

ops.each do |i|
  if i == 0
    shaffle!(cards)
  else
    cut!(cards,i)
  end
end

puts cards