#include <bits/stdc++.h>
using namespace std;
const int e = 1e6 + 9;
const long long mod = 1e9 + 7;
long long pre[e];
long long a[e];
int main() {
  int n, q;
  cin >> n >> q;
  map<long long, long long> kt;
  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;
    for (int i = 31; i >= 0; i--) {
      long long curr = cur >> i;
      if (curr & 1) {
        if (kt[1 << i] == 0) {
          ans = false;
        } else
          dem++;
      }
    }
    if (ans == false)
      cout << -1 << "\n";
    else
      cout << dem << "\n";
  }
}
