#had to go through the editorial
from math import log2
n,q=map(int,input().split())
a=list(map(int,input().split()))
li=[0]*32
for i in a:
    li[len(bin(i)[2:])-1]+=1
print(li)
for _ in range(q):
    ans=0
    k=int(input())
    for i in range(31,-1,-1):
        mini=min(k>>i,li[i])
        ans+=mini
        k-=(1<<i)*mini
        if k==0:
            break
    if k!=0:
        print(-1)
    else:
        print(ans)
        
    
    


    
    
