N,M=(int(i) for i in input (). split ()) A=[int (i) for i in input (). split ()] #rint (A) C=[int (i+1) for i in range(N)] #rint (C) for i in range (M): R=A[i] C.pop(A[i]-1) C.insert(0,R) print (C[0])