#include <bits/stdc++.h>
using namespace std;
unordered_map<int, size_t> mp;
int func(size_t x) {
  int count = 0, num = 0;
  for (size_t i = 0; i <= 31; ++i) {
    size_t tmp = (1 << (31 - i));
    if (x >= tmp && mp.find(tmp) != mp.end()) {
      count += min(mp[tmp], x / tmp);
      x -= min(mp[tmp], x / tmp) * tmp;
    }
  }
  if (x == 0)
    return count;
  else
    return -1;
}
int main() {
  int n, q;
  size_t st = 0;
  cin >> n >> q;
  size_t x;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    st |= x;
    ++mp[x];
  }
  for (int i = 0; i < q; ++i) {
    scanf("%d", &x);
    if (~(~x | st) == 0) {
      cout << __builtin_popcount(x) << '\n';
    } else {
      cout << func(x) << '\n';
    }
  }
}
