#include <bits/stdc++.h>
using namespace std;
int log2(int d) { return (int)(log10(d) / log10(2)); }
int main() {
  int n, q;
  cin >> n >> q;
  vector<int> a(n, 0);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  while (q--) {
    int t;
    cin >> t;
    if (t % 2 != 0) {
      cout << "-1" << endl;
      continue;
    }
    vector<int> d(40, 0);
    for (int i = 0; i < (n); ++i) d[log2(a[i])]++;
    vector<int> p;
    int k = 0;
    while (t > 0) {
      if (t % 2 != 0) {
        p.push_back(k);
      }
      t = t / 2;
      k++;
    }
    int f = 1;
    int a = 0;
    for (int i = 0; i < (p.size()); ++i) {
      if (d[p[i]] > 0) {
        d[p[i]]--;
        a++;
      } else {
        int k = 2;
        while (p[i] > 0 && d[--p[i]] > k) {
          k++;
        }
        if (p[i] == 0) {
          f = 0;
          break;
        }
        a += k;
        d[p[i]] -= k;
      }
    }
    if (f == 0) {
      cout << "-1" << endl;
    } else {
      cout << a << endl;
    }
  }
  return 0;
}
