import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class CF1003D {

    public static void main(String[] args) {
        FastReader reader = new FastReader();
        int n = reader.nextInt();
        int q = reader.nextInt();

        int[] coins = new int[32];
        for (int i = 0; i < n; i++) {
            int coin = reader.nextInt();

            for (int idx = 0; idx < 32; idx++) {
                if ((coin & 1) > 0) {
                    coins[idx]++;
                }
                coin >>= 1;
            }
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < q; i++) {
            int result = 0;
            int query = reader.nextInt();
            int[] localCoins = coins.clone();
            for (int idx = 0; idx < 32; idx++) {
                if ((query & 1) > 0) {
                    int rem = 1 << idx;
                    for (int j = idx; j >= 0 && rem > 0; j--) {
                        int cost = 1 << j;
                        int take = Math.min(localCoins[j], rem / cost);
                        localCoins[j] -= take;
                        result += take;
                        rem -= cost * take;
                    }
                    if (rem != 0) {
                        result = -1;
                        break;
                    }
                }
                query >>= 1;
            }
            sb.append(result).append('\n');
        }
        System.out.println(sb.toString());
    }

    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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;
        }
    }


}