#include <bits/stdc++.h>
using namespace std;
long long n, k;
string s;
int MOD = 1e9 + 7;
const int INF = 1e9;
const long long INF64 = 2e18;
const double PI = 3.141592653589793238463;
long long ar[1000004], ar1[1000004], vis[1000004], pre[1000004], dp[2][1000004];
vector<long long> le, rt;
set<long long> myset;
pair<long long, pair<long long, long long> > segs[1000004];
map<long long, long long> mymap;
long long c = 1;
string st1[1000004], st2[1000004];
vector<long long> arr[1000004];
int comp(string a, string b) {
  int i = 0, j = 0;
  while (i < a.size() && j < b.size()) {
    if (a[i] != b[j]) return a[i] < b[j];
    i++, j++;
  }
  return a.size() < b.size();
}
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) return 0;
  if (a == b) return a;
  if (a > b) return gcd(a - b, b);
  return gcd(a, b - a);
}
vector<int> bin(long long a) {
  vector<int> bi;
  while (a / 2) {
    if (a % 2)
      bi.push_back(1);
    else
      bi.push_back(0);
    a /= 2;
  }
  if (a) bi.push_back(1);
  return bi;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  long long q;
  cin >> n >> q;
  for (int i = 0; i < int(n); i++) {
    cin >> ar[i];
    for (int j = 0; j < 50; j++) {
      if (pow(2, j) == ar[i]) vis[j]++;
    }
  }
  for (int i = 0; i < int(q); i++) {
    cin >> n;
    for (int j = 0; j < int(50); j++) ar1[j] = vis[j];
    vector<int> binval = bin(n);
    c = 0;
    int fl = true;
    for (int j = 0; j < int(binval.size()); j++) {
      if (binval[j]) {
        if (ar1[j])
          ar1[j]--, c++;
        else {
          long long mult = 1;
          int flag = false;
          for (k = j; k >= 0; k--) {
            if (ar1[k] >= mult) {
              ar1[k] -= mult;
              c += mult;
              flag = true;
              break;
            } else {
              mult -= ar1[k];
              c += ar1[k];
              ar1[k] = 0;
            }
            mult *= 2;
          }
          if (!flag) fl = false;
        }
      }
      if (!fl) break;
    }
    if (fl)
      cout << c << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
