n,q=list(map(int,input().split()))
a = list(map(int,input().split()))
queries=[]
bits = []

for i in range(31):
    bits.append(0)
for i in range(n):
    bits[len(bin(a[i]))-3]+=1
for i in range(q):
    queries.append(int(input()))
for i in range(q):
    possible = True
    binRep = bin(queries[i])[2:]
    binRep=binRep[::-1]
    coins = binRep.count("1")
    for j in range(len(binRep)):
        if (binRep[j]=='1' and bits[j]==0):
            possible = False
            break
    if possible:
        print(coins)
    else:
        print(-1)
