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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(
                new InputStreamReader(System.in));

        StringTokenizer st = new StringTokenizer(br.readLine());

        int n = Integer.parseInt(st.nextToken());
        int q = Integer.parseInt(st.nextToken());

        st = new StringTokenizer(br.readLine());

        int[] coins = new int[20];

        for (int i = 0; i < n; i++) {
            int val = Integer.parseInt(st.nextToken());
            int pow = (int) Math.round(Math.log(val) / Math.log(2));
            coins[pow] += 1;
        }

        for (int i = 0; i < q; i++) {
            st = new StringTokenizer(br.readLine());
            int query = Integer.parseInt(st.nextToken());

            System.out.println("Query = " + query);

            int usedCoins = 0;

            for (int j = (int) Math.round(Math.log(query) / Math.log(2)); j >= 0; j--) {
                int divisor = (int) Math.pow(2, j);
                if (divisor <= query) {
                    int divisions = Math.min(query/divisor, coins[j]);
                    System.out.println("Dividing " + query + " by " + divisor + " : " + divisions + " times");
                    query -= divisions * divisor;
                    usedCoins += divisions;
                } else {
                    System.out.println("Cannot divide " + query + " by " + divisor);
                }
            }

            if (query != 0) {
                usedCoins = -1;
            }

            System.out.println(usedCoins);
        }
    }
}
