import std.stdio, std.conv, std.string, std.range, std.math, std.algorithm; void main() { auto input = readln.split.to!(int[]); auto N = input[0], M = input[1]; auto A = readln.split.to!(int[]); auto card = 1.iota(N + 1).array; A.each!(i => card=card[i-1]~card[0..i-1]~card[i..$]); card[0].writeln; }