#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e9;
const long long N = 3e1 + 1;
const long long mod = 1e9 + 7;
const long double eps = 1E-7;
int d[N], p[N];
int n, m, x, y, sum, ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> x, d[int(log2(x))]++;
  for (int i = 1; i <= m; i++) {
    ans = 0;
    cin >> x;
    for (int j = 0; j < N; j++) p[j] = d[j];
    for (int j = N - 1; j >= 0; j--) {
      sum = 0;
      if (x & (1ll << j)) sum = (1ll << j);
      for (int h = j; h >= 0; h--) {
        y = min(d[h], sum / (1 << h));
        ans += y, p[h] -= y, sum -= y * (1 << h);
      }
    }
    if (sum) ans = -1;
    cout << ans << endl;
  }
}
