#include <bits/stdc++.h>
using namespace std;
using namespace std;
struct foe {
  int first;
  int second;
  int sum;
  int last;
};
int n, q;
vector<foe> A;
void fix();
int main() {
  cin >> n >> q;
  A.assign(45, {0, 0, 0, 0});
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    int mask = 1, sc = 0;
    while (mask < x) {
      mask <<= 1;
      sc++;
    }
    A[sc].first++;
    A[sc].sum = 1;
  }
  for (int h = 0; h < q; h++) {
    long long x;
    cin >> x;
    long long mask = (1ll << 35);
    int lastone = 2000000000, used = 0, sc = 35, county = 0;
    while (mask > 0) {
      if (mask & x) {
        if (lastone > sc && A[sc].first) {
          county++;
        } else {
          int cnt = 0;
          int summu = 0;
          int lst = 2000000000;
          int usd = 0;
          for (int j = min(sc, lastone) - 1; j >= 0; j--) {
            if (!A[j].first) continue;
            if (j == lastone - 1 && used) {
              if (A[j].first > 1) {
                summu += (1 << j);
                cnt += 1;
                usd = 1;
                if (summu >= (1 << sc)) {
                  break;
                }
                summu += (1 << j) * (A[j].first - 2);
                cnt += A[j].first - 2;
                lst = j;
                usd = 0;
                if (summu >= (1 << sc)) {
                  break;
                }
              }
            } else {
              summu += (1 << j);
              cnt += 1;
              usd = 1;
              if (summu >= (1 << sc)) {
                break;
              }
              summu += (1 << j) * (A[j].first - 1);
              cnt += A[j].first - 1;
              lst = j;
              usd = 0;
              if (summu >= (1 << sc)) {
                break;
              }
            }
          }
          if (summu >= (1 << sc)) {
            county += cnt;
            lastone = lst;
          } else {
            cout << -1 << "\n";
            break;
          }
        }
      }
      mask >>= 1;
      sc--;
    }
    if (!mask) {
      cout << county << "\n";
    }
  }
}
void fix() {
  for (int i = 0; i < 35; i++) {
    while (A[i].first >= 3) {
      A[i + 1].first++;
      A[i].first -= 2;
    }
  }
}
