n = gets.to_i
deck = []
(2*n).times do |i|
	deck << i+1
end

m = gets.to_i

tmp = []
m.times do
	k = gets.to_i
	if(k == 0) then
 		n.times do |i|
 			tmp << deck[i]
 			tmp << deck[n+i]
 		end
 	else
		for i in k..deck.length-1
			tmp << deck[i]
		end
		
		for i in 0..k-1
			tmp << deck[i]
		end
	end
	
 	deck = Marshal.load(Marshal.dump(tmp))
	tmp.clear
	
end

puts deck