m,n=map(int,input().split()) a=input().split() tar=input().split() for i in tar: if i in a: print(a.index(i)+1,end=" ") else: print(-1,end=" ")