import sys
input = sys.stdin.readline
out = sys.stdout

def cbits(x):
	i=0
	while x:
		x>>=1
		i+=1
	return i

bits=[0]*31
n,q=map(int,input().split())
a=map(int,input().split())
for b in a:
	c=cbits(b)-1
	bits[c]+=1

for i in range(q):
	ans=0
	x=int(input())
	num=cbits(x)
	for j in range(num,-1,-1):
		p=1<<j
		c=x//p
		t=min(bits[j],c)*p
		x-=t
		ans+=min(bits[j],c)
		if x==0:
			break
	if x==0:
		out.write(str(ans) +'\n')
	else:
		out.write('-1' +'\n')
