#include <bits/stdc++.h>
using namespace std;
int dcmp(long double n, long double y) {
  return fabs(n - y) <= 1e-9 ? 0 : n < y ? -1 : 1;
}
vector<long long> p;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, q;
  cin >> n >> q;
  long long a[n];
  map<long long, long long> cnt1, cnt2;
  for (int i = 0; i < (int)(n); ++i) {
    cin >> a[i];
    for (int j = 0; j < (int)(32); ++j) {
      if (a[i] & (1LL << j)) cnt1[j]++;
    }
  }
  for (int i = 0; i < (int)(q); ++i) {
    long long tmp;
    cin >> tmp;
    bool ok = 1;
    cnt2 = cnt1;
    long long ans = 0;
    long long fin = 0;
    for (long long j = 32; j >= 0; j--) {
      if (tmp & (1LL << j)) {
        long long need = 1;
        long long cur = j;
        while (need > 0 && cur >= 0) {
          if (cnt2[cur] >= need) {
            fin += (1LL << cur) * need;
            ans += need;
            cnt2[cur] -= need;
            need = 0;
            break;
          } else {
            need -= cnt2[cur];
            fin += (1LL << cur) * cnt2[cur];
            cnt2[cur] = 0;
            need *= 2;
            cur--;
          }
        }
        ok &= ((need == 0) || (fin == tmp));
      }
    }
    if (ok) {
      cout << ans << '\n';
    } else {
      cout << -1 << '\n';
    }
    cnt2.clear();
  }
}
