from sys import stdin, stdout
import math

n, q = map(int, stdin.readline().strip().split())
ar = list(map(int, stdin.readline().strip().split()))
ones = []
for i in ar:
    ones.append(int(math.log2(i)))

ones = set(ones)
##print(ones)

for _ in range(q):
    cur = int(stdin.readline().strip())
    cur = bin(cur)[2:]
    cur = cur[::-1]
    flag = True
    for i in range(len(cur)):
        if cur[i] == '1' and i not in ones:
            flag = False
            break

    if flag: stdout.write(str(cur.count('1')) + '\n')
    else: stdout.write(str(-1) + '\n')
