  def riffle(deck)
    a=[]
    a = deck[0,deck.size/2]
    b=[]
    b = deck-a
    c = Array.new
    (a.size*2).times{|i|
      c<<(i%2==0 ? a.shift : b.shift)
    }
  c
  end

  def cut(deck,k)
    (deck-deck[0,k])+deck[0,k]
  end
n = gets.to_i
m = gets.to_i
deck = (1..2*n).to_a

m.times do
  k = gets.to_i
  if k==0 then  deck=riffle(deck) else deck=cut(deck,k) end
end

deck.each{|x|
  puts x
}