N,M = map(int,input().split()) shuffle_card = list(map(int,input().split())) N = list(range(1,N+1)) for i in range(M): shuffle_num = shuffle_card[i] work = N[shuffle_num - 1] del N[shuffle_num - 1] N.insert(0,work) print(N[0])