

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt(), q = s.nextInt();
		int[] arr = new int[32];
		for(int i = 0; i < n; i++){
			long a = s.nextLong();
			for(int j = 0; j < 31; j++){
				if( ((a>>j) & 1) == 1){
					arr[j]++;
					break;
				}
			}
		}
		int[] dp = new int[32];
		for(int i = 0; i < 32; i++){
			dp[i] = -1;
		//	System.out.print(arr[i] + " ");
		}
		for(int i = 0; i < 32; i++){
			if(arr[i] > 0){
				for(int j = 1; j <= arr[i] && j + i - 1 < 32; j++){
					if(dp[j + i - 1] == -1){
						dp[j + i - 1] = j;
					}else{
						dp[j + i - 1] = Math.min(dp[j + i - 1], j);
					}
				}
			}
		}
		for(int i = 0; i < q; i++){
			long a = s.nextLong(), ans = 0;
			for(int j = 0; j < 32; j++){
				if(((a >> j) & 1) == 1){
					if(dp[j] == -1){
						ans = -1;
						break;
					}else{
						ans += dp[j];
					}
				}
			}
			System.out.println(ans);
		}

	}

}
