#include <bits/stdc++.h>
using namespace std;
int a[30];
int n, q;
int main() {
  scanf("%d%d", &n, &q);
  while (n--) {
    int k;
    scanf("%d", &k);
    for (int j = 0;; j++)
      if ((1 << j) & k) {
        a[j]++;
        break;
      }
  }
  int ans;
  while (q--) {
    int k;
    ans = 0;
    scanf("%d", &k);
    int b[30];
    memset(b, 0, sizeof(b));
    int t = 0;
    for (int i = 30; i >= 0; i--) {
      t *= 2;
      if ((1 << i) & k) {
        if (a[i] - b[i] > 0)
          b[i]++, ans++;
        else
          t++;
      }
      if (a[i] - b[i] > 0 && t > 0) {
        if (t > a[i] - b[i])
          t = t - (a[i] - b[i]), ans = ans + (a[i] - b[i]), b[i] = a[i];
        else
          b[i] += t, ans += t, t -= t;
      }
    }
    if (t == 0)
      printf("%d\n", ans);
    else
      printf("-1\n");
  }
}
