#include <bits/stdc++.h>
using namespace std;
int getCoins(long long x, unordered_map<long long, int> f) {
  int ret = 0;
  for (long long i = 32; i >= 0 && x; i--) {
    long long v = 1 << i;
    if (v <= x && f.find(v) != f.end() && f[v] > 0) {
      int mn = x / v;
      mn = min(mn, f[v]);
      x -= mn * v;
      ret += mn;
    }
  }
  return (x == 0) ? ret : -1;
}
int main() {
  int n, q;
  cin >> n >> q;
  vector<long long> v(n);
  unordered_map<long long, int> f;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &v[i]);
    f[v[i]]++;
  }
  while (q--) {
    long long x;
    scanf("%lld", &x);
    printf("%d\n", getCoins(x, f));
  }
  return 0;
}
