#include <bits/stdc++.h>
using namespace std;
long long have[34];
long long process(long long x) {
  long long sum = 0;
  long long tmp_have[34];
  for (long long i = 0; i <= 32; i++) tmp_have[i] = have[i];
  while (x) {
    long long tmp = 31 - __builtin_clz(x);
    long long other_tmp = tmp;
    long long need_to_use = 1;
    while (1) {
      if (tmp < 0) return -1;
      if (tmp_have[tmp] >= need_to_use) {
        sum += need_to_use;
        tmp_have[tmp] -= need_to_use;
        break;
      }
      tmp--;
      need_to_use *= 2;
    }
    x &= ~(1 << other_tmp);
  }
  return sum;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, q, k;
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) {
    cin >> k;
    int tmp = 0;
    while (k > 1) {
      k /= 2;
      tmp++;
    }
    have[tmp]++;
  }
  long long x;
  while (q--) {
    cin >> x;
    cout << process(x) << '\n';
  }
  return 0;
}
