#include <bits/stdc++.h>
using namespace std;
void debug_vec(vector<long long>& v) {
  cout << '[';
  for (auto i : v) cout << i << ", ";
  cout << "]";
  cout << "\n";
}
void debug_set(set<long long>& st) {
  cout << "{";
  for (auto i : st) cout << i << ", ";
  cout << "}";
  cout << "\n";
}
void fast() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
bool prime[1000001];
void sieve() {
  memset(prime, true, sizeof(prime));
  prime[1] = false;
  for (int p = 2; p * p <= 1000000; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= 1000000; i += p) prime[i] = false;
    }
  }
}
void print(bool f) {
  if (f)
    cout << "YES\n";
  else
    cout << "NO\n";
}
void google(int x) { cout << "Case #" << x << ": "; }
long long binary_expo(long long a, long long b) {
  long long res = 1;
  while (b != 0) {
    if (b & 1) {
      res = (res * a) % 1000000007;
    }
    b >>= 1;
    a = (a * a) % 1000000007;
  }
  return res;
}
void solve() {
  long long n;
  cin >> n;
  long long q;
  cin >> q;
  map<long long, long long> mp;
  long long x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    mp[x]++;
  }
  while (q--) {
    long long bi;
    cin >> bi;
    long long mini = 0;
    for (int i = 32; i >= 0; i--) {
      if ((1ll << i) <= bi) {
        long long res = min(mp[(1ll << i)], bi / (1ll << i));
        bi -= res * (1ll << i);
        mini += res;
      }
    }
    if (bi == 0)
      cout << mini << '\n';
    else
      cout << "-1\n";
  }
}
int main() {
  fast();
  solve();
  return 0;
}
