import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;

public class CoinsandQueries {

	void solve(Scanner in, PrintWriter out) {
		int n = in.nextInt();
		int q = in.nextInt();
		HashSet hs = new HashSet();
		for (int i = 0; i < n; i++) {
			hs.add(in.nextInt());

		}
		for (int i = 0; i < q; i++) {
			int v = in.nextInt();
			String s = Integer.toBinaryString(v);
			int pow = 0;
			boolean found = false;
			for (int j = s.length() - 1; j >= 0; j--) {
				int v1 = (s.charAt(j) - 48);

				v1 = v1 * (1 << pow);

				if (v1 != 0 && !hs.contains(v1)) {
					out.println(-1);
					found = true;
					break;
				}

				pow++;

			}
			if (!found)
				out.println(Integer.bitCount(v));

		}

	}

	void run() {
		try (Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out);) {
			solve(in, out);
		}
	}

	public static void main(String args[]) {
		new CoinsandQueries().run();
	}
}
