#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  vector<int> freq(32);
  int n, m;
  cin >> n >> m;
  for (int i = 0, x; i < n; i++) {
    cin >> x;
    freq[__builtin_ctz(x)]++;
  }
  for (; m; m--) {
    int x;
    cin >> x;
    int ans = 0, c = 0, req = 0;
    for (int i = 30; i + 1; i--) {
      c += (x & (1 << i)) ? 1 : 0;
      int k = min(freq[i], c);
      req += k;
      ans += k * (1 << i);
      c -= k;
      c *= 2;
    }
    if (ans != x) {
      req = -1;
    }
    cout << req << "\n";
  }
}
