
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;

public class Solution {
	public static void main(String[] args) {
		new Solution().run();
	}
	
	public void run() {
		Scanner in = new Scanner(System.in);
		int totalCoins = in.nextInt();
		int tests = in.nextInt();
		
		HashMap<Long, Integer> coins = new HashMap<Long, Integer>();
		for (int i = 0; i < totalCoins; i++) {
			Long coin = in.nextLong();
			int count = 1;
			if (coins.containsKey(coin)) {
				count += coins.get(coin);
			}
			coins.put(coin, count);
		}
		
		
		HashMap<Long, Integer> copyCoins;
		Queue<Long> sum = new LinkedList<Long>();
		StringBuilder result = new StringBuilder();
		while(tests--> 0) {
			int coinsUsed = 0;
			copyCoins = new HashMap<Long, Integer>(coins);
			
			boolean valid = true;
			
			sum.add(in.nextLong());
			while (!sum.isEmpty()) {
				Long temp = sum.poll();
				if (temp % 2 != 0) {
					if (temp == 1) {
						if (copyCoins.containsKey((long)1) && copyCoins.get((long)1) > 0) {
							copyCoins.put((long) 1, copyCoins.get((long)1) - 1);
							coinsUsed++;
						}
						else  {
							valid = false;
							break;
						}
					}
					else {
						sum.add((long) 1);
						sum.add(temp - 1);
					}
				}
				// else, check if 2 and no more coins or break apart
				else {
					if (temp == 2) {
						if (copyCoins.containsKey((long)2) && copyCoins.get((long)2) > 0) {
							copyCoins.put((long) 2, copyCoins.get((long)2) - 1);
							coinsUsed++;
						}
						else {
							valid = false;
							break;
						}
					}
					else {
						if (copyCoins.containsKey(temp) && copyCoins.get(temp) > 0) {
							copyCoins.put(temp, copyCoins.get(temp)- 1);
							coinsUsed++;
						}
						else {
							if (Long.bitCount(temp) == 1) {
								sum.add(temp / 2);
								sum.add(temp / 2);
							}
							else {
								long findPowTwo = 1;
								while (findPowTwo * 2 < temp) {
									findPowTwo *= 2;
								}
								sum.add(findPowTwo);
								sum.add(temp - findPowTwo);
							}
						}
					}
				}
			}
			
			if (valid) {
				result.append(coinsUsed);
			}
			else {
				result.append("-1");
			}
			result.append("\n");
		}
		
		System.out.print(result.toString());
	}
}
