#encoding:utf-8 No.0513 2014.11.17
cards = (1..gets.chomp.to_i*2).to_a

gets.chomp.to_i.times do
  n = gets.chomp.to_i
  if n == 0 #リフルシャッフル
    stack1,stack2 = cards.each_slice(cards.length/2).to_a
    cards = []
    #cardsの初期化を行わないと二重に書き込まれてしまう。初期化のタイミングにも注意
    stack1.zip(stack2) do |a,b|
      cards << a << b
    end
  else #nの値に応じてカット
    cards = cards.each_slice(n).to_a
    cards << cards.delete_at(0)
    cards.flatten!
  end
end

puts cards