//package solution;

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

public final class Solution {
    BufferedReader br;
    StringTokenizer stk;

    public static void main(String[] args) throws Exception {
        new Solution().run();
    }
    
    {
        stk = null;
        br = new BufferedReader(new InputStreamReader(System.in));
    }
    
    long mod = 1000_000_000 + 7;
    StringBuilder res = new StringBuilder(1000005);
    
    void run() throws Exception {
        int n = ni();
        int q = ni();
        int[] a = new int[34];
        HashMap<Long, Integer> map = new HashMap<>();
        for(int i = 0; i <= 33; i++) {
            long num = 1L << i;
            map.put(num, i);
        }
        for(int i = 0; i < n; i++) {
            long num = nl();
            a[map.get(num)]++;
        }
        //System.out.println(Arrays.toString(a));
        
        while(q-- > 0) {
            long num = nl();
            if(num == 0) {
                res.append(0).append("\n");
                continue;
            }
            int value = recur(num, Arrays.copyOf(a, 34));
            res.append(value <= 0 ? -1 : value).append("\n");
        }
        
        System.out.print(res);
    }
    
    int recur(long num, int[] a) {
        if(num == 0) {
            return 0;
        }
        String s = new StringBuilder(Long.toBinaryString(num)).reverse().toString();
        int count = 0;
        for(int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == '1' && a[i] > 0) {
                count++;
                a[i]--;
                num -= (1L << i);
            }
        }
        if(count == 0) {
            return -1;
        }
        return count + recur(num, a);
    }
    
    //Reader & Writer
    String nextToken() throws Exception {
        if (stk == null || !stk.hasMoreTokens()) {
            stk = new StringTokenizer(br.readLine(), " ");
        }
        return stk.nextToken();
    }

    String nt() throws Exception {
        return nextToken();
    }

    int ni() throws Exception {
        return Integer.parseInt(nextToken());
    }

    long nl() throws Exception {
        return Long.parseLong(nextToken());
    }
}