#include <bits/stdc++.h>
const double pi = 3.1415926535897932384626433832795028841971;
int bin(int arr[], int u, int val) {
  int x;
  int l = 0;
  while (l <= u) {
    x = (l + u) / 2;
    if (val == arr[x])
      return val;
    else if (val > arr[x]) {
      l = x + 1;
    } else
      u = x - 1;
  }
  return -1;
}
long long gcd(long long a, long long b) {
  if (b == 1)
    return 1;
  else if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, q, i, j, k;
  cin >> n >> q;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  while (q--) {
    int b;
    cin >> b;
    long long ans = 0;
    int ctr = 0;
    while (b != 0) {
      int rem = b % 2;
      ctr++;
      b /= 2;
      if (rem == 0)
        continue;
      else if (ctr == 1) {
        int al = bin(a, n - 1, 1);
        if (al == -1) {
          ans = -1;
          break;
        } else {
          ans++;
        }
      } else {
        int f = bin(a, n - 1, pow(2, ctr - 1));
        if (f != -1)
          ans++;
        else {
          int m = ctr - 2;
          while (m >= 1) {
            f = bin(a, n - 1, pow(2, m));
            if (f != -1) {
              ans += pow(2, ctr - m - 1);
              m = -10;
              break;
            } else
              m--;
          }
          if (m != -10) {
            ans = -1;
            break;
          }
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
