#include <bits/stdc++.h>
using namespace std;
long long int i, j, n, a[200005], query, sum = 0, x, y, cnt, county[33],
                                         num[33], q;
vector<long long int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> query;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    bitset<32> b(a[i]);
    for (j = 0; j < 32; j++) {
      if (b[j] == 1) county[j]++;
    }
  }
  while (query-- != 0) {
    bool final = 0;
    cnt = 0;
    cin >> q;
    bitset<32> b(q);
    memset(num, 0, sizeof num);
    for (i = 0; i < 32; i++) {
      num[i] = b[i];
    }
    for (i = 31; i >= 0; i--) {
      if (i > 0 && num[i] != 0 && county[i] == 0) {
        num[i - 1] += num[i] * 2;
        num[i] = 0;
      } else if (i > 0 && num[i] != 0 && county[i] < num[i]) {
        num[i - 1] += (num[i] - county[i]) * 2;
        cnt = cnt + county[i];
        num[i] = 0;
      } else if (num[i] != 0 && county[i] >= num[i]) {
        cnt = cnt + num[i];
        num[i] = 0;
      } else if (i == 0 && county[i] >= num[i]) {
        cnt = cnt + num[i];
      }
    }
    for (j = 0; j < 32; j++) {
      if (num[j] != 0) {
        final = 1;
        break;
      }
    }
    if (final)
      cout << "-1" << endl;
    else
      cout << cnt << endl;
  }
}
