#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;
    map<long long, long long> mp2;
    for (i = 0; i <= 30; i++) mp2[1 << i] = mp[1 << i];
    for (i = 30; i >= 0; i--) {
      if ((1 << i) & l) {
        if (mp2[(1 << i)])
          cnt++, mp2[(1 << i)]--;
        else {
          k = i - 1;
          if (mp2[1 << k] >= 2)
            cnt += 2, mp2[1 << k] -= 2;
          else {
            long long tt = k - 1;
            if (mp2[1 << tt]) {
              mp2[1 << tt] -= 2;
              cnt += 2;
            }
            if (mp2[1 << k] == 1) {
              cnt += 1;
              mp2[1 << k]--;
            } else {
              tt = k - 1;
              if (mp2[1 << tt]) {
                mp2[1 << tt] -= 2;
                cnt += 2;
              } else {
                ok = false;
                break;
              }
            }
          }
        }
      }
    }
    if (ok)
      cout << cnt << endl;
    else
      cout << -1 << endl;
  }
}
