N,M = map(int,input().split()) A = list(map(int,input().split())) L = [i+1 for i in range(N)] for a in A : a -= 1 t = L[a] del L[a] L = [t] + L print(L[0])