#include <bits/stdc++.h>
using namespace std;
map<long long, int> mp;
map<long long, int> ans;
long long a[200005];
long long p = 0;
int main() {
  std::ios::sync_with_stdio(0);
  long long n, m, i, j, k;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> k;
    mp[k]++;
  }
  ans = mp;
  for (i = 1; i <= m; i++) {
    mp = ans;
    cin >> k;
    int qq = 0;
    for (j = 32; j >= 0; j--) {
      long long sum = 2, po = 1;
      while (po * 2 < j) {
        sum *= sum;
        po *= 2;
      }
      for (po; po <= j; po++) {
        sum *= 2;
      }
      while (k > 0 && mp[sum] > 0 && sum <= k) {
        k -= sum;
        mp[sum]--;
        qq++;
        if (k == 0) break;
      }
      if (k == 0) break;
    }
    if (k == 0)
      cout << qq << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
