#include <bits/stdc++.h>
using namespace std;
int arr[50];
int crr[50];
int brr[50];
int power(long long int a) {
  int b = 0;
  while (a != 1) {
    a = a / 2;
    b++;
  }
  return b;
}
int yes(int a) {
  int b, c, d, i, j, k = 0;
  int sum, ans;
  d = a;
  ans = int(pow(2, a) + 0.5);
  if (arr[a]) {
    arr[a]--;
    return 1;
  } else {
    while (1) {
      if (d == 0) return -1;
      b = d--;
      c = arr[b];
      sum = c * int(pow(2, b) + 0.5);
      if (sum <= ans) {
        ans = ans - sum;
        arr[b] = 0;
        k = c;
      } else {
        k = ans / (int(pow(2, b) + 0.5));
        arr[b] -= k;
        ans = 0;
      }
      if (ans == 0) return k;
    }
  }
  return -1;
}
int main() {
  long long int a, b, c, i, j, k, n, m, t, q, sum = 0, f, g, ans, ls;
  cin >> n >> q;
  for (i = 0; i < n; i++) {
    cin >> a;
    sum += a;
    b = power(a);
    arr[b]++;
    crr[b]++;
  }
  for (ls = 0; ls < q; ls++) {
    for (t = 0; t < 50; t++) arr[t] = crr[t];
    cin >> a;
    if (sum < a) {
      cout << -1 << endl;
      continue;
    }
    f = -1;
    ans = 0;
    memset(brr, 0, sizeof(brr));
    while (1) {
      if (a == 0) break;
      b = power(a);
      if (b > f) f = b;
      brr[b]++;
      c = int(pow(2, b) + 0.5);
      a = a - c;
    }
    for (i = 0; i <= f; i++) {
      if (brr[i] == 1) {
        g = yes(i);
        if (g == -1) {
          cout << -1 << endl;
          break;
        }
        ans += g;
      }
    }
    if (g != -1) cout << ans << endl;
  }
  return 0;
}
