import java.io.*;
import java.util.*;
import java.util.stream.Collectors;

public class D {
    public static BufferedReader input;
    public PrintWriter output;
    public static StringTokenizer stoken = new StringTokenizer("");

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String nums = reader.readLine();
        int n = Integer.parseInt(nums.split(" ")[0]);
        int q = Integer.parseInt(nums.split(" ")[1]);
        HashMap<Integer, Integer> money = new HashMap<>();
        for (long i = 1; i < 2_000_000_100; i = i * 2) {
            money.put((int)i, 0);
        }
        nums = reader.readLine();
        for (Integer pp : Arrays.stream(nums.split(" ")).map(x->Integer.parseInt(x)).collect(Collectors.toList())) {
            money.put(pp, money.get(pp) + 1);
        }

        List<Integer> ms = money.keySet().stream().collect(Collectors.toList());
        Collections.sort(ms);
        Collections.reverse(ms);

        HashMap<Integer, Integer> results = new HashMap<>();
        for (int i = 0; i < q; i++) {
            int res = 0;
            int b = Integer.parseInt(reader.readLine());

            if (results.containsKey(b)) {
                System.out.println(results.get(b));
            } else {
                for (Integer x : ms) {
                    int count = b / x;
                    count = count < money.get(x) ? count : money.get(x);
                    b = b - x * count;
                    res += count;
                }

                res = b != 0 ? -1 : res;
                System.out.println(res);
                results.put(b, res);
            }

        }
    }
}
