#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q, a;
  unordered_map<int, int> mp;
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    mp[a]++;
  }
  for (int i = 0; i < q; i++) {
    scanf("%d", &a);
    if (a % 2 != 0) {
      printf("-1\n");
      continue;
    }
    int cnt = 0;
    for (int i = 31; i >= 0; i--) {
      int val = pow(2, i);
      if (i == 31) val = INT_MAX;
      if (val <= a) a -= val, cnt++;
    }
    if (a != 0) cnt = -1;
    printf("%d\n", cnt);
  }
}
