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