

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class D {

	public static void main(String[] args) {

		Scanner nik = new Scanner(System.in);
		int n = nik.nextInt();
		long[] a = new long[n];
		HashMap<Long, Integer> ht = new HashMap<>();

		for (int i = 31; i >= 0; i--) {
			long temp = 1L << i;
			ht.put(temp, 0);
		}

		int q = nik.nextInt();

		for (int i = 0; i < n; i++) {
			a[i] = nik.nextLong();
			ht.put(a[i], ht.getOrDefault(a[i], 0) + 1);

		}
		Arrays.sort(a);

		StringBuilder sb = new StringBuilder();
		while (q-- > 0) {
			long sum = nik.nextLong();
			int c = 0;
			for (int i = 4; i >= 0; i--) {
				long temp = 1L << i;
				long min = Math.min(sum / temp, ht.get(temp));
				sum -= (temp * min);
				if (min != 0) {
					c++;
				}
				if (sum <= 0) {
					break;
				}
			}
			if (sum == 0) {
				sb.append(c + "\n");
			} else {
				sb.append(-1 + "\n");
			}

		}
		System.out.println(sb);
	}

}
