#include <bits/stdc++.h>
using namespace std;
const int maxN = (int)2e3, maxM = (int)1e2, intMax = INT_MAX, maxValue = 44721,
          mod = (int)1e9 + 7;
const long long llmax = LLONG_MAX, INF = (long long)1e9 + 1;
long long nod(long long a, long long b) {
  while (a != 0 && b != 0) {
    if (a < b)
      b %= a;
    else
      a %= b;
  }
  return a + b;
}
int nod(int a, int b) {
  while (a != 0 && b != 0) {
    if (a < b)
      b %= a;
    else
      a %= b;
  }
  return a + b;
}
long long nok(long long a, long long b) { return a * b / nod(a, b); }
int nok(int a, int b) { return a * b / nod(a, b); }
long long modPlus(long long a, long long b) {
  a %= mod;
  b %= mod;
  return a + b;
}
int modPlus(int a, int b) {
  a %= mod;
  b %= mod;
  return a + b;
}
int n, q;
long long b;
vector<long long> Q;
int main() {
  scanf("%d%d", &n, &q);
  Q.resize(n);
  for (int i = 0; i < n; scanf("%lld", &Q[i++]))
    ;
  sort(begin(Q), end(Q));
  for (int i = 0; i < q; i++) {
    scanf("%d", &b);
    int res = 0;
    while (b >= Q[0]) {
      int l = 0;
      int r = n;
      while (l < r - 1) {
        int half = (l + r) >> 1;
        if (Q[half] > b)
          r = half;
        else
          l = half;
      }
      res += b / Q[l];
      b %= Q[l];
    }
    if (b == 0)
      printf("%d\n", res);
    else
      printf("%d\n", -1);
  }
  return 0;
}
