N, M = [int(i) for i in input().strip().split(' ')] A = [int(i) for i in input().strip().split(' ')] lst = list(range(1, N + 1))[::-1] for i in A: tmp = lst.pop(N - i) lst.append(tmp) print(lst[-1])