#include <bits/stdc++.h>
using namespace std;
const double PI =
    3.14159265358979323846264338327950288419716939937510582097494459230;
const long long MOD = 1e9 + 7;
const long long INF = 1e17;
long long mpow(long long a, long long b) {
  a = a % MOD;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b = b >> 1;
  }
  return res % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, q;
  cin >> n >> q;
  map<long long, long long> m;
  for (int i = 0; i < (int)(n); ++i) {
    long long x;
    cin >> x;
    m[x]++;
  }
  while (q--) {
    long long b;
    cin >> b;
    long long ans = 0;
    long long f = 0;
    long long ans1 = 0;
    if (b % 2 == 0) {
      long long u = b / 2;
      if (m[2] >= u) {
        ans1 += u;
      }
    }
    while (b) {
      if (b & 1) {
        if (m[1 << f] == 0) {
          long long o = 1 << f;
          long long r = 0;
          for (long long j = 1;; j++) {
            long long p = 1 << j;
            if (o / p == 0) break;
            if (m[p] >= (o / p)) {
              r = 1;
              ans += o / p;
            }
          }
          if (r == 0) {
            ans = -1;
            break;
          }
        } else {
          ans++;
        }
      }
      b = b >> 1;
      f++;
    }
    if (ans1 != 0) {
      if (ans == -1) {
        cout << ans1 << "\n";
      } else {
        cout << min(ans, ans1);
      }
      continue;
    }
    cout << ans << "\n";
  }
  return 0;
}
