#include <bits/stdc++.h>
using namespace std;
vector<long long> vec[(long long)1e6];
long long vis[(long long)1e6];
void coding() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long i, j, k, l, m, n, t;
  cin >> n >> m;
  vector<long long> v(31);
  for (i = 0; i < n; i++) {
    long long a;
    cin >> a;
    v[__builtin_ctz(a)]++;
  }
  while (m--) {
    long long a;
    cin >> a;
    j = 0;
    for (i = 30; i >= 0 && a > 0; i--) {
      k = min(a >> i, v[i]);
      j += k;
      a -= (1 << i) * k;
    }
    if (a != 0) j = -1;
    cout << j << endl;
  }
}
signed main() {
  long long test = 1;
  while (test--) {
    coding();
  }
}
