n = gets.to_i
m = gets.to_i

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

m.times do
  k = gets.to_i
  if k == 0
    new_cards = []
    n.times do |i|
      new_cards[2*i]   = cards[i]
      new_cards[2*i+1] = cards[n+i]
    end
    cards = new_cards
  else
    cards = cards[k..2*n] + cards[0..k-1]
  end
end

cards.each do |card|
  puts card
end