#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
map<int, int> mq;
int sum;
int asd(int x) {
  int temp = 0;
  sum = 0;
  int y, z, g;
  x >>= 1;
  y = 2;
  while (x) {
    if ((x & 1) != 0) {
      g = 1;
      z = 0;
      if (mp[y] != 0) {
        sum++;
        mp[y]--;
        z = 1;
        g = 0;
      } else {
        g = y;
        z = y;
        if (z == 2) {
          temp = 1;
          break;
        }
        z = z / 2;
        while (g != 0) {
          if (mp[z] >= g / z) {
            mp[z] -= g / z;
            sum += g / z;
            g = 0;
          } else if (mp[z] > 0) {
            g = g - z * mp[z];
            sum += mp[z];
            mp[z] = 0;
          }
          z = z / 2;
          if (z == 1) break;
        }
      }
      if (g != 0) temp = 1;
    }
    y = y * 2;
    x >>= 1;
  }
  if (temp == 1) return 0;
  return sum;
}
int main() {
  int n, m, a, kkk;
  while (cin >> n >> m) {
    mq.clear();
    sum = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a);
      mq[a]++;
    }
    for (int i = 0; i < m; i++) {
      mp = mq;
      cin >> kkk;
      int g = asd(kkk);
      if (kkk % 2 || g == 0)
        cout << "-1" << endl;
      else
        cout << g << endl;
    }
  }
}
