#include <bits/stdc++.h>
using namespace std;
int tc = 1;
const int M = 1e9 + 7;
const long long Inf = (long long)2e18 + 5;
const int N = 2e5 + 5;
int solve() {
  int n, m;
  cin >> n >> m;
  int a[n + 1];
  std::map<int, int> m1;
  set<int> s;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    m1[x] = 1LL;
    s.insert(x);
  }
  int b[n + 1];
  int j = 0;
  for (int i : s) {
    b[j++] = i;
  }
  int bsz = j;
  while (m--) {
    int z;
    cin >> z;
    int c = 0;
    int cnt = 0;
    bool f = true;
    bool g = true;
    while (z) {
      if (z & 1) {
        int xx = 1 << c;
        if (m1[xx])
          cnt++;
        else {
          for (int k = bsz - 1; k >= 0; k--) {
            if (xx % b[k] == 0) {
              cnt += xx / b[k];
              g = false;
              break;
            }
          }
          if (g) {
            f = false;
            cout << -1 << endl;
          }
          break;
        }
      }
      c++;
      z >>= 1;
    }
    if (f) cout << cnt << endl;
  }
  return 0;
}
int main() {
  int test = 1;
  while (test--) solve();
  return 0;
}
