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