import java.io.*;
import java.util.*;
import java.awt.*;
public class div494D
{
	BufferedReader in;
	PrintWriter ob;
	StringTokenizer st;
	HashMap<Long , Long> hm;
	public static void main(String[] args) throws IOException {
		new div494D().run();
	}
	void run() throws IOException {
		//in=new BufferedReader(new FileReader("input.tmovest"));
		in=new BufferedReader(new InputStreamReader(System.in));
		ob=new PrintWriter(System.out);
		solve();
		ob.flush();
	}
	void solve() throws IOException {
		int n = ni() , q = ni();
		int a[] = new int[n];
		int f[] = new int[60];
		for(int i=0 ; i<n ; i++ ) {
			a[i] = ni();
			f[Integer.numberOfTrailingZeros(a[i])]++;
		}
		while(q-->0) {
			int ret = 0;
			int m = ni();
			char s[] = Integer.toBinaryString(m).toCharArray();
			int d[] = Arrays.copyOf( f , 60 );
			int bit = 0;
			for(int i=s.length-1 ; i>=0 ; i--) {
				if(s[i]=='1') {
					if(d[bit]>0) {
						++ret;
						--d[bit];
					}
					else {
						int index = -1;
						Point p = new Point(-1,-1);
						int min = Integer.MAX_VALUE;
						int remove = 0;
						for(int j=bit-1 ; j>=0 ; j--) {
							int rem = bit-j;
							if( d[rem]>0 && d[j]>0) {
								int res = d[rem] + d[j];
								if(res<min) {
									min = res;
									p  = new Point(rem , j);
								}
							}

							int req = (int)Math.pow(2,bit-j);
							if(d[j]>=req) {
								if(req<min) {
									min = req;
									index = j;
									remove = req;
								}	
							}
						}
						if(min == Integer.MAX_VALUE) {
							ret = -1;
							break;
						}
						else if(p.x!=-1)
						{
							ret += min;
							--d[p.x];
							--d[p.y];
						}
						else {
							ret+=min;
							d[index]-=remove;
						}
					}
				}
				++bit;
			}
			if(ret==-1) ob.println("-1");
			else
				ob.println(ret);
		}

	}

	String ns() throws IOException {
		return nextToken();
	}
	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}
	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}
	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	} 
	String nextToken() throws IOException {
		if(st==null || !st.hasMoreTokens())
			st=new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int[] nia(int start,int b) throws IOException {
		int a[]=new int[b];
		for(int i=start;i<b;i++)
			a[i]=ni();
		return a;
	}
	long[] nla(int start,int n) throws IOException {
		long a[]=new long[n];
		for (int i=start; i<n ;i++ ) {
			a[i]=nl();
		}
		return a;
	}
}