#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, q;
  cin >> n >> q;
  vector<int> a;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int c1[32] = {0};
  for (int i = 0; i < n; i++) {
    c1[(int)log(a[i]) + 1]++;
  }
  for (int i = 0; i < q; i++) {
    int u;
    cin >> u;
    int c2[32] = {0};
    for (int j = 0; j < 32; j++) {
      c2[j] = c1[j];
    }
    int c = 0;
    bool b1 = 0;
    for (int j = 0; j < 32; j++) {
      if (((1 << j) & u) != 0) {
        if (c2[j] == 0) {
          int y = 2;
          bool b2 = 0;
          for (int h = j - 1; h >= 0; h--) {
            if (y <= c2[h]) {
              c2[h] -= y;
              b2 = 1;
              c += y;
              break;
            }
            y *= 2;
          }
          if (b2 == 0) {
            b1 = 1;
            break;
          }
        } else {
          c++;
          c2[j]--;
        }
      }
    }
    if (b1 == 0) {
      cout << c << "\n";
    } else {
      cout << -1 << "\n";
    }
  }
  return 0;
}
