#include <bits/stdc++.h>
using namespace std;
int n, q, x;
long long y, a[32], b[32], c[32];
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i <= 31; i++) {
    b[i] = pow(2, i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &y);
    int c = lower_bound(b, b + 32, y) - b;
    a[c]++;
  }
  for (int i = 0; i <= 31; i++) {
    c[i] = a[i];
  }
  while (q--) {
    int ans = 0;
    scanf("%d", &x);
    bool f = 0;
    for (int i = 0; i <= 31; i++) {
      a[i] = c[i];
    }
    while (x > 0) {
      int c = upper_bound(b, b + 32, x) - b - 1;
      x -= b[c];
      int d = 1;
      while (1) {
        if (c < 0) {
          f = 1;
          break;
        }
        if (a[c] >= d) {
          a[c] -= d;
          ans += d;
          break;
        } else {
          c--;
          d *= 2;
        }
      }
      if (f) {
        break;
      }
    }
    if (f) {
      cout << -1;
    } else {
      cout << ans;
    }
    puts("");
  }
  return 0;
}
