N, M = map(int, input().split()) X = [i for i in range(1, N + 1)] for a in map(int, input().split()): x = X.pop(a - 1) X = [x] + X print(X[0])