#include <bits/stdc++.h>
const long long LLINF = (1ll << 63) - 1;
const int INF = (1 << 31) - 1;
const long double PI = 3.141592653589793;
const long double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int MOD2 = 16714589;
const int ENGLISH_ALPHABET_SIZE = 26;
const int N = 1e6 + 1;
const int M = 1e9 + 10;
using namespace std;
int main() {
  long long n, q, ones = 0;
  scanf("%lld%lld", &n, &q);
  map<long long, long long> vals;
  for (long long i = 0, x; i < n; ++i) {
    scanf("%lld", &x);
    vals[x]++;
    if (x == 1) ones++;
  }
  vector<long long> bits(34, 0);
  for (long long i = 0, x, res = 0, cnt; i < q; ++i) {
    scanf("%lld", &x);
    for (long long bit = 32; bit >= 0; --bit) {
      if (x & (1 << bit)) bits[bit]++;
    }
    for (long long bit = 32; bit >= 0; --bit) {
      cnt = vals[1 << bit];
      res += min(cnt, bits[bit]);
      if (!bit && bits[0] > ones)
        res = -1;
      else if (bit)
        bits[bit - 1] += 2 * max(0ll, (bits[bit] - cnt));
      bits[bit] = 0;
    }
    printf("%lld\n", res);
    res = 0;
  }
  return 0;
}
