n = gets.to_i
card = (1..(n * 2)).to_a
gets.to_i.times do
  case k = gets.to_i
  when 0
    tmp1 = card[0..(n - 1)]
    tmp2 = card.drop(n)
    card = []
    n.times do |num|
      card << tmp1[num]
      card << tmp2[num]
    end
  else
    tmp = card[0..(k - 1)]
    card = card.drop(k).concat(tmp)
  end
end
puts card