n, q = map(int, raw_input().split())

arr = map(int, raw_input().split())
freq = {}
for i in arr:
	a = len(bin(i)) - 2
	if a not in freq:
		freq[a] = 0
	freq[a] += 1

print freq
for i in xrange(q):
	q = int(raw_input())
	q = bin(q)
	q = q[2:]
	lenq = len(q) - 2
	ans = True
	ansn = 0
	#print q
	for j in xrange(len(q)):
		if q[j] == "1" and len(q) - j not in freq:
			ans = False
		elif q[j] == "1":
			ansn+=1
	if ans:
		print ansn
	else:
		print -1