#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int n, q, x, cnt[40];
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    double t = (log10(x) / log10(2));
    cout << t << " " << int(t) << endl;
    cnt[int(t)]++;
  }
  while (q--) {
    scanf("%d", &x);
    int res = 0, t = x;
    for (int i = 30; i >= 0; i--)
      if (cnt[i]) {
        if (t > cnt[i] * (1 << i))
          t -= cnt[i] * (1 << i), res += cnt[i];
        else
          res += t / (1 << i), t = t % (1 << i);
        if (!t) break;
      }
    if (t) res = -1;
    printf("%d\n", res);
  }
  return 0;
}
