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

for i in range(32):
    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):
    temp = bits[::]
    possible = True
    binRep = bin(queries[i])[2:]
    binRep=binRep[::-1]
    coins = 0
    convCoins = 0
    for j in range(len(binRep)):
        if (binRep[j]=='1'):
            if (temp[j]==0):
                possible = False
                break
            else:
                if (bits[j]==0):
                    coins+=convCoins
                    convCoins=0
                else:
                    coins+=1
                temp[j]-=1
        temp[j+1]+=temp[j]//2
        if(temp[j]//2>0):
            convCoins+=2
    if possible:
        print(coins)
    else:
        print(-1)
