import java.util.*;

public class DD {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int[] arr =new int[32];
		for(int i = 0;i<a;i++){
			int curr = scan.nextInt();
			arr[(int) (Math.log(curr)/Math.log(2))]++;
		}
		int[] arr1 = new int[b];
		for(int i = 0;i<b;i++){
			arr1[i] = scan.nextInt();
		}
		for(int i = 0;i<b;i++){
			int num = 0;
			int curr = arr1[i];
			
			for(int j =31;j>=0;j-- ){
				if(arr[j]==0)continue;
				int pow = (int) Math.pow(2, j);
				if(pow>curr)continue;
				if(pow==curr){
					curr-=pow;
					num++;
					break;
				}
				if(curr%pow==0){
					if(arr[j]>=curr/pow){
						num+=curr/pow;
						break;
					}
					else{
						num+=Math.min(arr[j],curr/pow);
						curr-=(arr[j]*pow);
					}
				}
				else{
					num+=Math.min(arr[j], curr/pow);
					curr-=Math.min(arr[j]*pow,curr/pow*pow);
				}
				
			}
			if(curr!=0)System.out.println(-1);
			else
			System.out.println(num);
		}
	}

}
