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