#include <bits/stdc++.h>
#pragma GCC optimize("03")
using namespace std;
int freq[40], F[40], n, q, num, x;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    for (int i = 0; i <= 30; i++)
      if ((1 << i) == x) freq[i]++;
  }
  while (q--) {
    cin >> num;
    int ans = 0;
    bool f = 1;
    for (int i = 30; i >= 0; i--) {
      if (((1 << i) & num) == 0) continue;
      int need = (1 << i);
      for (int j = i; j >= 0; j--)
        if (need) {
          int aux = need / (1 << j);
          if (freq[j] >= aux) {
            ans += aux;
            need = 0;
            break;
          }
          ans += freq[j];
          need -= freq[j] * (1 << j);
        }
      if (need > 0) {
        cout << "-1\n";
        f = 0;
        break;
      }
    }
    if (f) cout << ans << '\n';
  }
  return 0;
}
