n = gets.chomp.to_i
cards = (1..2*n).to_a

m = gets.chomp.to_i
m.times do
	k = gets.chomp.to_i
	if k == 0
		a = cards[0..n-1]
		b = cards[n..2*n-1]
		cards = a.zip(b).flatten
	else
		a = cards[0..k-1]
		b = cards[k..2*n-1]
		cards = b + a
	end
end

cards.each do |c|
	puts c
end