N, M = map(int, input().split()) A = list(map(int, input().split())) P = [N-i for i in range(N)] for a in A: r = P.pop(N-a) P.append(r) print(P[-1])