#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
map<long long, long long> mp2;
map<long long, long long> mp3;
long long countSetBits(long long n) {
  if (n == 0)
    return 0;
  else
    return 1 + countSetBits(n & (n - 1));
}
int main() {
  long long i, j, k, l, m, n, q, cnt;
  cin >> n >> q;
  long long a[n + 10];
  for (i = 0; i < n; i++) cin >> a[i], mp[a[i]]++;
  while (q--) {
    cin >> l;
    cnt = 0;
    bool ok = true;
    for (i = 0; i <= 30; i++) mp2[1 << i] = mp[1 << i], mp3[1 << i] = 0;
    for (i = 30; i >= 0; i--) {
      if ((1 << i) & l) {
        if (mp2[1 << i]) {
          cnt++;
          mp2[1 << i]--;
        } else {
          k = i - 1;
          mp3[1 << k] += 2;
        }
      } else if (mp3[1 << i]) {
        if (mp2[1 << i]) {
          long long pp = min(mp2[1 << i], mp3[1 << i]);
          mp2[1 << i] -= pp;
          mp3[1 << i] -= pp;
          cnt += pp;
        }
      }
    }
    for (i = 0; i <= 30; i++) {
      if (mp3[1 << i]) {
        ok = false;
        break;
      }
    }
    if (cnt < countSetBits(l)) ok = false;
    if (ok)
      cout << cnt << endl;
    else
      cout << -1 << endl;
  }
}
