#include <bits/stdc++.h>
using namespace std;
long long cpp2[40], m[40];
vector<long long> v[40];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, q, b, k, f, ans;
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) {
    cin >> b;
    cpp2[(long long)log2(b)]++;
  }
  for (long long i = 0; i <= 34; i++) {
    k = 1;
    b = 1LL << i;
    while ((b / k)) {
      if (cpp2[(long long)log2((b / k))] >= k)
        v[(long long)log2(b)].push_back(log2((b / k)));
      k *= 2;
    }
  }
  while (q--) {
    cin >> b;
    ans = 0;
    f = 0;
    for (long long i = 0; i <= 34; i++) m[i] = cpp2[i];
    for (long long i = 34; i >= 0; i--)
      if (b & (1LL << i)) {
        k = 1LL << i;
        f = 0;
        for (long long j = 0; j < v[i].size(); j++) {
          if (m[v[i][j]] >= (k / (1LL << v[i][j]))) {
            m[v[i][j]] -= (k / (1LL << v[i][j]));
            f = 1;
            ans += (k / (1LL << v[i][j]));
            break;
          }
        }
        if (!f) break;
      }
    if (!f)
      cout << -1 << endl;
    else
      cout << ans << endl;
  }
}
