import math
n,m = [int(x) for x in raw_input().split()]
s = [int(x) for x in raw_input().split()]
t = max(s)
maxs = int(math.log(t)/math.log(2))
l = [0]*(maxs+1)
for i in range(n):
	temp = int(math.log(s[i])/math.log(2))
	l[temp]+=1
print l
i = 0
while i<m:
	t = input()
	j = maxs
	count = 0
	while t and j>=0:
		ch = 0
		while ch<l[j] and math.pow(2,j)<=t:
			t-=math.pow(2,j)
			count+=1
			ch+=1
		j-=1
	if t==0:
		print count
	else:
		print -1
	i+=1
