import java.io.*;
import java.util.*;

public class p1003d {
	public static PrintWriter out;
	public static InputReader in;

	public static void main(String[] args)throws IOException {
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);
		// int lul = 1<<30;
		// out.println("lul:"+lul);
		int n = in.nextInt();
		int q = in.nextInt();
		long val;
		long ct[][] = new long[31][31];
		long ct2[][] = new long[31][31];
		for(int i=0;i<31;i++)
			Arrays.fill(ct[i],0);
		for(int i=0;i<n;i++)
		{
			val = in.nextLong();
			long cmp=1;
			for(int j=0;j<31;j++)
			{
				if(cmp==val)
				{
					ct[j][j]++;
					break;
				}
				cmp<<=1;
			}
		}
		for(int i=30;i>=0;i--)
		{
			for(int j=i-1;j>=0;j--)
			{
				int diff = i-j;
				if(ct[j][j]>=(long)(1<<(long)diff))
				{
					ct[i][j]=1;
				}
			}
		}
		for(int i=0;i<q;i++)
		{
			val = in.nextLong();
			long cmp = 1<<30;
			long count = 0;
			for(int j=0;j<31;j++)
				for(int k=0;k<31;k++)
				{
					ct2[j][k]=ct[j][k];
				}
			for(int j=30;j>=0;j--)
			{
				if((val&cmp)!=0)
				{
					boolean fd=false;
					for(int k=j;k>=0;k--)
					{
						if(ct2[j][k]>=1 && ct2[k][k]>=(long)(1<<(long)(j-k)))
						{
							fd=true;
							count+=(long)(1<<(long)(j-k));
							ct2[k][k]-=(long)(1<<(long)(j-k));
							break;
						}
					}
					if(!fd) break;
					val-=cmp;
				}
				cmp>>=1;
			}
			if(val>0)
			{
				out.println(-1);
				continue;
			}
			out.println(count);
		}
		out.close();
	}
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}