#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  map<int, int> m;
  int temp;
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    if (m.count(temp))
      m[temp]++;
    else
      m[temp] = 1;
  }
  while (q--) {
    cin >> temp;
    bitset<19> b(temp);
    vector<int> v(19);
    for (int i = 0; i < 19; ++i) v[i] = b[i];
    int coins = 0;
    bool done = true;
    for (int i = 19; i >= 0; --i) {
      if (v[i])
        if (m[1 << i] >= v[i]) {
          coins += v[i];
          v[i] = 0;
        } else {
          if (i == 0) {
            cout << -1 << endl;
            ;
            done = false;
            break;
          } else
            v[i - 1] += 2 * v[i];
        }
    }
    if (done) cout << coins << endl;
  }
}
