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; foreach (i; 0 .. M) { auto tmp = card[A[i] - 1]; card[1 .. A[i]] = card[0 .. A[i] - 1].dup; card[0] = tmp; } card[0].writeln; }