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