nq = list(map(int, input().split(' ')))
n = nq[0]
q = nq[1]

a = list(map(int, input().split(' ')))
ans = 0
z = []

for i in range(q):
	z.append(int(input()))
	
cnt = {}

t = 1

while t <= 2**30:
	cnt.update({t:0})
	t *= 2
		
for i in range(n):
	cnt[a[i]] += 1

for i in range(q):
	t = 2**30
	
	while t > 0:
		cur = min(z[i]//t, cnt[t])
		ans += cur
		z[i] -= t*cur
		if(t == 1):
			break
		else:
			t /= 2
	
	if(z[i] != 0):
		ans = -1
	
	print(ans)