#include <bits/stdc++.h>
using namespace std;
bool fl = true;
map<long long, long long> kt;
long long chk(long long cur) {
  long long ans = 0;
  if (cur == 1 && kt[cur] == 0) {
    fl = false;
    return 0;
  }
  for (int i = 0; i <= 32; i++) {
    long long curr = cur >> i;
    if (curr & 1) {
      if (kt[1 << i] == 0) {
        if (curr == cur >> i) {
          fl = false;
          break;
        }
        if (chk(1 << i) == 0) {
          ans += chk(1 << i);
        }
      } else {
        ans++;
      }
    }
  }
  if (ans == 0) fl = false;
  return ans;
}
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    kt[x]++;
  }
  for (int i = 1; i <= q; i++) {
    long long cur;
    cin >> cur;
    bool ans = true;
    int dem = 0;
    fl = true;
    dem += chk(cur);
    if (!fl)
      cout << -1 << "\n";
    else
      cout << dem << "\n";
  }
}
