#include <bits/stdc++.h>
using namespace std;
long long n, q, d, a, bit, st, w, x, i, j, ans;
long long t[100], number[100], b[100], k[100];
int main() {
  cin >> n >> q;
  for (i = 1; i <= n; i++) {
    cin >> a;
    d = 1;
    for (j = 0; j <= 35; j++) {
      if (a == d) t[j]++;
      d *= 2;
    }
  }
  for (i = 1; i <= q; i++) {
    cin >> x;
    for (j = 0; j <= 35; j++) b[j] = t[j];
    st = 0;
    w = 0;
    while (x != 0) {
      bit = x % 2;
      number[st] = bit;
      if (bit > b[st]) {
        w = 1;
        break;
      }
      st++;
      b[st] += (b[st - 1] - bit) / 2;
      x /= 2;
    }
    if (w == 1) {
      cout << -1 << "\n";
      continue;
    }
    for (j = 0; j <= 35; j++) k[j] = 0;
    st--;
    ans = 0;
    for (j = st; j >= 0; j--) {
      k[j] += number[j];
      if (t[j] >= k[j]) {
        ans += k[j];
      } else {
        ans += t[j];
        k[j - 1] += (k[j] - t[j]) * 2;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
