import java.util.Scanner;
import java.util.Arrays;
import java.lang.Math;

public class CF1003DD3{

	public static void main(String[] args){

		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int q = in.nextInt();

		int [] coins = new int [33];

		for(int i = 0; i < n; i++){
			int input = in.nextInt();
			coins[log2OfPower2(input)]++ ;
		}

		int [] qs = new int [q];

		for(int i = 0; i < q; i++){
			qs[i] = in.nextInt();
		}

		for(int i = 0; i < q; i++){
			solve(qs[i], coins.clone());
		}


	}
	private static void solve(int b, int [] coins){
		
		int res = 0;

		for(int i = 30; i >= 0; i--){

			int coin = TwoPowerI(i);

			while(coins[i] > 0 && b >= coin){

				int needed = b / coin;
				b -= coin * needed;
				coins[i]--;
				res++;
			}

		}

		if(b == 0) 	System.out.println(res);
		else System.out.println(-1);

	}

	public static int log2OfPower2(int a){
		int res = 0;
		while((a & 1) == 0 && a != 0){
			res++;
			a >>= 1;
		}

		return res;
	}

	public static int TwoPowerI(int i){
		return 1 << i;
	}

}