def helper(x):
	result = 1
	while result <= x:
		result *= 2
	return result/2

def findMin(coins, x, tested):
	result = 0
	msf = helper(x)
	dic = dict()
	while (x > 0):
		if x in tested:
			result += tested[x]
			x = 0
			break
		while msf > x: 
			msf = msf/2
		temp = 1
		count = msf
		added = False
		while count > 0:
			if count in coins:
				if count in dic:
					dic[count] += temp
				else: dic[count] = temp
				added = True
				break
			count = count/2
			temp *= 2
		if added: 
			result += temp
		else: break
		x = x - msf
	if x == 0: 
		for key in dic:
			if dic[key] > coins[key]: return -1
		return result
	return -1

def main_function():
	s = ""
	linenum = 0
	coins = dict()
	tested = dict()
	x = ""
	numlines = int(input().split(" ")[1])
	result = []
	temp = 0
	s = input()

	for c in s.split(" "):
		if c in coins:
			coins[int(c)] += 1
		else: coins[int(c)] = 1

	for i in range(numlines):
		if (i > 100): s = "100000"
		else: s = input()
		x = int(s)
		temp = findMin(coins, x, tested)
		if x not in tested: 
			tested[x] = temp
		result.append(str(temp))

	print("\n".join(result))

main_function()


