n=list(range(int(input().split()[0]))) for i in list(map(int,input().split())):n=[n.pop(i-1)]+n print(n[0]+1)