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