from math import pow

def solve(n,count):
	b = bin(n)
	used = [0 for i in range(40)]
	b=list(b)
	b = b[2:]
	b.reverse()
	flag = True
	for i in range(len(b)):
		if b[i] =='0':
			continue
		cur = int(pow(2,i))
		#print cur
		if b[i] == '1':
			if cur in count and count[cur]>=used[i]+1:
				used[i]+=1
			else:
				j = i-1
				temp = int(pow(2,j))
				while j>=0:
					if temp in count and count[temp]>=used[j]+cur//temp:
						used[j] += cur//temp
						break
					j-=1
				if j == -1:
					flag = False
					break
		if not flag:
			break
	#print used
	if not flag:
		return -1
	else:
		return sum(used)



n,q = map(int,raw_input().split())
arr = map(int,raw_input().split())
count = {}

for i in arr:
	if i not in count:
		count[i] = 1
	else:
		count[i]+=1


for i in range(q):
	quer = int(raw_input())
	if quer%2==1:
		print -1
	else:
		ans = solve(quer, count)
		print ans


