#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const double eps = 1e-9;
int daysInMonths[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int di[] = {-1, 0, 1, 0};
int dj[] = {0, 1, 0, -1};
map<long long, int> v, temp;
const int MAXLOG = 39;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, q, ans = 0;
  long long x;
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &x);
    v[x]++;
  }
  while (q--) {
    scanf("%I64d", &x);
    ans = 0;
    temp = v;
    for (int k = MAXLOG; k >= 0; k--) {
      long long a = (1 << k);
      if (x >= a && v[a]) {
        x -= a;
        temp[a]--;
        ans++;
      }
    }
    if (x == 0)
      printf("%d\n", ans);
    else
      printf("-1\n");
  }
  return 0;
}
