#include <bits/stdc++.h>
using namespace std;
const int MD = 1000000007;
long long A[100000 + 1], dp[100000 + 1];
long long exp(long long a, long long b) {
  long long r = 1;
  while (b > 0) {
    if (b & 1) r = r * a;
    b /= 2;
    a = a * a;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t, n, i, s, j, p, m, x, y, k, q;
  string s1;
  map<long long, long long> mp;
  for (i = 0; i <= 32; i++) mp.insert({exp(2, i), i});
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    A[mp[x]]++;
  }
  while (m--) {
    cin >> x;
    p = 0;
    for (i = 32; i >= 0; --i) {
      k = min(x / exp(2, i), A[i]);
      p += k;
      x -= k * exp(2, i);
    }
    if (x != 0)
      cout << "-1\n";
    else
      cout << p << "\n";
  }
}
