#include <bits/stdc++.h>
using namespace std;
long long int make_pair(long long int x) {
  long long int mul = 1;
  while (x--) mul = mul * 2;
  return mul;
}
void solve(map<long long int, long long int> temp) {
  long long int x, ans = 0, cnt = 0;
  cin >> x;
  while (x > 0) {
    if (x % 2 == 0) {
      x = x / 2;
      cnt++;
      continue;
    }
    if (x % 2 == 1 && temp[cnt] > 0) {
      ans++;
      temp[cnt]--;
    } else {
      int i = cnt - 1;
      for (; i >= 0; i--) {
        long long int po = make_pair(cnt - i);
        if (temp[i] >= po) {
          temp[i] -= po;
          ans += po;
          break;
        }
      }
      if (i < 0) {
        cout << -1 << endl;
        return;
      }
    }
    x = x / 2;
    cnt++;
  }
  cout << ans << endl;
  return;
}
int main() {
  long long int n, q, x;
  cin >> n >> q;
  map<long long int, long long int> s;
  for (int i = 0; i < n; i++) {
    cin >> x;
    s[log2(x)]++;
  }
  while (q--) {
    solve(s);
  }
  return 0;
}
