from collections import defaultdict
n,q=map(int,input().split())
a=list(map(int,input().split()))
d=defaultdict(int)
for i in range(n):
    d[a[i]]+=1
c=[]
for i in d:
    c.append([i,d[i]])
c.sort(reverse=True)
print(c)
for _ in range(q):
    b=int(input())
    d=0
    for j in range(len(c)):
        d+=min(b//c[j][0],c[j][1])
        b-=c[j][0]*min(b//c[j][0],c[j][1])
    if b==0:
        print(d)
    else:
        print(-1)
