import java.util.*;
import java.io.*;
import java.util.Map.Entry;

public class Contest {

    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()), q = Integer.parseInt(st.nextToken());
        int[] c = new int[n];
        st = new StringTokenizer(br.readLine());
        HashMap<Integer, Integer> hashMap = new HashMap<>();
        for (int i = 0; i < n; i++) {
            c[i] = Integer.parseInt(st.nextToken());
            if(!hashMap.containsKey(c[i])) {
            	hashMap.put(c[i], 1);
            }else {
            	hashMap.replace(c[i], hashMap.get(c[i]) + 1);
            }
        }
        query: while (q-- > 0) {
            int b = Integer.parseInt(br.readLine());
            HashMap<Integer, Integer> tmp = new HashMap<>(hashMap);
            int ans = 0, sum = 0;
            for (int i = 0; i <= 30; i++) {
                if (((1 << i) & b) != 0) {
                    if (tmp.containsKey(1 << i)) {
                        ans++;
                        sum += 1 << i;
                        tmp.replace(1 << i, tmp.get(1 << i) - 1);
                        if (tmp.get(1 << i) == 0) {
                            tmp.remove(1 << i);
                        }
                    }else {
                        int w = (1<<i) / 2;
                        int quantity = 2, tmpSum = 0;
//                        System.out.println(w);
//                        System.out.println(quantity);
//                        System.out.println();
                        while(w > 0 && tmpSum < (1<<i)){
                            if(tmp.containsKey(w)){
                                ans += Math.min(quantity, tmp.get(w));
                                sum += w * Math.min(quantity, tmp.get(w));
                                tmpSum += w * Math.min(quantity, tmp.get(w));
                                tmp.replace(w, tmp.get(w) - Math.min(quantity, tmp.get(w)));
                                if(tmp.get(w) == 0){
                                    tmp.remove(w);
                                }
                            }
                            w /= 2;
                            quantity *= 2;
                        }
                        if(tmpSum != (1<<i)){
                            System.out.println(-1);
                            continue query;
                        }
                    }
                }
            }
            if(sum == b){
                System.out.println(ans);
            }else{
            	System.out.println(-1);
            }
        }
    }
}