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

public class Solution {

    public static void main(String[] args) throws Exception {
        MyScanner scan = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int coinCount = scan.nextInt();
        int queryCount = scan.nextInt();
        int[] coin = new int[32];
        for (int i = 0; i < coinCount; i++) {
            coin[(int) (Math.log(scan.nextInt()) / Math.log(2))]++;
        }
        coin = new int[32];
        coin[0] = 200000;
        StringBuilder sb = new StringBuilder();
        for (int tc = 0; tc < queryCount; tc++) {
            int[] coinCopy = Arrays.copyOf(coin, coin.length);
            int q = scan.nextInt();
            //int q = 200000;
            sb.append(solve(q, coinCopy)).append("\n");
        }
        out.println(sb.toString());
        out.close();
    }

    static int solve(int input, int[] coin) {
        int usedCoin = 0;
        for (int i = 31; i >= 0; i--) {
            if (((input >> i) & 1) == 1) {
                int curr = (int) Math.pow(2, i);
                for (int j = i; j >= 0; j--) {
                    int candidateCoinWorth = (int) Math.pow(2, j);
                    if (coin[j] > 0 && curr / candidateCoinWorth >= 0) {
                        int spendCoin = Math.min(curr / candidateCoinWorth, coin[j]);
                        curr -= spendCoin * candidateCoinWorth;
                        usedCoin += spendCoin;
                        coin[j] -= usedCoin;
                    }
                    if (curr == 0) break;
                }
                if (curr != 0) {
                    return -1;
                }
            }
        }
        return usedCoin;
    }

    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------

}