n, m = map(int, input().split())
list_n = list(map(int, input().split()))
list_aim = list(map(int, input().split()))
sum_list = len(list_aim)
a = []
def check(number, list1, count, long):
if number == list1[len(list1)//2]:
if number != list1[len(list1)//2-1] or list1[len(list1)//2] == 1:
a.append(len(list1)//2+1)
return
else:
return check(number, list1[:len(list1)//2], count, long)
elif count > (long*2):
a.append(-1)
return
elif number > list1[len(list1)//2]:
count += 1
return check(number, list1[len(list1)//2:], count, long)
else:
count += 1
return check(number, list1[:len(list1)//2], count, long)
for i in list_aim:
check(i, list_n, 0, sum_list)
for i in a:
print(i, end=' ')