#include <bits/stdc++.h>
using namespace std;
const long long INF = (2 * 1e9);
long long get(long long a) {
  for (long long i = 0; i < 31; ++i) {
    if ((a >> i) & 1) {
      return i;
    }
  }
}
signed main() {
  long long n, q;
  cin >> n >> q;
  set<long long> v;
  for (long long i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    v.insert(a);
  }
  vector<long long> dp(32, INF);
  for (auto i : v) {
    dp[get(i)] = 1;
  }
  for (long long i = 0; i < 32; ++i) {
    if (i == 0) continue;
    dp[i] = min(dp[i], dp[i - 1] * 2);
  }
  for (long long i = 0; i < q; ++i) {
    long long ans = 0;
    long long a;
    cin >> a;
    for (long long j = 0; j < 31; ++j) {
      if ((a >> j) & 1) {
        ans += dp[j];
      }
    }
    if (ans >= 1e9) {
      cout << -1 << endl;
    } else {
      cout << ans << endl;
    }
  }
}
