a,b=map(int,input().strip().split())
c=list(map(int,input().strip().split()))
d=list(map(int,input().strip().split()))
for x in d:
left,right=0,a-1
while left <=right:
e=(left+right)//2
if c[e]==x:
print(e+1)
break
elif c[e]>x:
right=e-1
else:
left=e+1
else:
print(0)