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

public class D {

	
	static void hello()
	{
		cnt = Arrays.copyOfRange(count,0,32);
	}
	static int exist = 0;
	
	static int make(int bit, int req)
	{
		if(bit==-1)
		{
			exist = -1;
			return 0;
		}
		if(cnt[bit]>=req)
		{
			cnt[bit]-=req;
			return req;
		}
		else
		{
			if(bit==0)
			{
				exist = -1;
			}
			int ans = 0;
			ans+=cnt[bit];
			req-=cnt[bit];
			return ans + make(bit-1,2*req);
		}
	}
	
	static int[] count;
	static int[] cnt;
	
	static long b(int i)
	{
		return (long)Math.pow(2,i);
	}
	public static void main(String[] args) {
		
		FastScanner s = new FastScanner();
		int n = s.nextInt();
		int q = s.nextInt();
		count = new int[40];
		for(int i=0;i<n;i++)
		{
			long g = s.nextLong();
			for(int bit = 0;bit<=32;bit++)
			{
				if((g&b(bit))!=0)	
					count[bit]++;
			}
		}
		
		StringBuilder sb = new StringBuilder();
		
		while(q-->0)
		{
			long Q = s.nextLong();
			int steps = 0;
			hello();
			for(int i = 34;i>=0;i--)
			{
				
				int ans = 0;
				if((Q&b(i))!=0)
				{
					exist = 0;
					int y = make(i,1);
					if(exist==-1)
					{
						sb.append(-1+"\n");
						break;
					}
					else steps+=y;
					
				}
			}
			if(exist==0)
			sb.append(steps+"\n");
		}
		System.out.println(sb);
	}
	
static class FastScanner {
		
	    private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner() {
			this(System.in);
		}

		public FastScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		
		}	

	}

}
