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

public class Solution {
    
    public static void main(String[] args) throws IOException {
        new Solution().run();
    }
    
    public void run() throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st =  new StringTokenizer("");
        st = new StringTokenizer(br.readLine());
        int totalCoins = Integer.parseInt(st.nextToken());
        int tests = Integer.parseInt(st.nextToken());
        
        //HashMap<Integer, Long> coins = new HashMap<Integer, Long>();
        int[] coins = new int[30];
        int[] coinValues = new int[30];
        coinValues[0] = 1;
        for (int i = 1; i < 30; i++) {
            coinValues[i] = 2 * coinValues[i - 1];
        }
        int tempCoin;
        Long count;
        st = new StringTokenizer(br.readLine());
        for (int i = 0; i < totalCoins; i++) {
            count = (long) 1;
            tempCoin = Integer.parseInt(st.nextToken());
//            if (coins.containsKey(tempCoin)) {
//                count += coins.get(tempCoin);
//            }
//            coins.put(tempCoin, count);
            coins[Integer.numberOfTrailingZeros(tempCoin)]++;
        }
        //Collections.sort(coins);
        
        StringBuilder result = new StringBuilder();
        long coinsUsed;
        long coinsToAdd;
        long availableCoins;
        int maxCoin;
        while(tests--> 0) {
            coinsUsed = 0;
            //int pointer = coins.size() - 1;
            
            boolean valid = true;
            st = new StringTokenizer(br.readLine());
            long value = Long.parseLong(st.nextToken());
            //maxCoin = findMaxCoin(value);
            maxCoin = 29;
            
            //long tempCoin;
            
            while (valid && value > 0 && maxCoin > 0) {
                if (coins[maxCoin] > 0) {
                    coinsToAdd = value / coinValues[maxCoin];
                    availableCoins = coins[maxCoin];
                    if (coinsToAdd >= availableCoins) {
                        coinsToAdd = availableCoins;
                    }
                    
                    coinsUsed += coinsToAdd;
                    value -= coinsToAdd * coinValues[maxCoin];
                }
                else if (maxCoin == 0){
                    valid = false;
                    break;
                }
                maxCoin--;
            }
            
            if (valid) {
                result.append(coinsUsed);
            }
            else {
                result.append("-1");
            }
            result.append("\n");
        }
        
        System.out.print(result.toString());
    }

    private int findMaxCoin(long value) {
        int result = 1;
        result = (int) (Math.log(value) / Math.log(2));
        result = (int) Math.pow(2, result);
        return result;
    }
}