from math import log
a = map(int,raw_input().split())
n = a[0]
q = a[1]
a = map(int,raw_input().split())
d = {}
for j in a:
    i = int(log(j,2))
    try:
        po = d[i]
        d[i] += 1
    except:
        d[i] = 1

l = d.keys()
l.sort(reverse = True)
print l
for t in range(q):
    b = input()
    c = 0
    for j in l:
        i = int(pow(2,j))
        f = min(d[j],b/i)
        c += f
        b -= i*f
        if(b == 0):
            break
    
    if(b):
        print -1
    else:
        print c
    
