#include <bits/stdc++.h>
int main() {
  long long n, q;
  scanf("%lld %lld", &n, &q);
  std::map<long long, long long> m;
  for (long long p = 0; p < n; p++) {
    long long x;
    scanf("%lld", &x);
    ++m[x];
  }
  while (q--) {
    long long b;
    scanf("%lld", &b);
    std::map<long long, long long> cur(m);
    long long cnt(0);
    for (long long pow = 1; pow <= 2e9; pow *= 2) {
      long long val = pow * ((b / pow) % 2);
      if (val == 0) {
        continue;
      }
      for (long long u = pow; u >= 1; u /= 2) {
        if (!cur.count(u)) {
          continue;
        }
        if (cur[u] * u >= val) {
          cur[u] -= val / u;
          cnt += val / u;
          val = 0;
          break;
        } else {
          cnt += cur[u];
          val -= cur[u] * u;
          cur[u] = 0;
        }
      }
      if (val > 0) {
        cnt = -1;
        break;
      }
    }
    printf("%lld\n", cnt);
  }
  return 0;
}
