#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
vector<bool> primes(2000);
void sieve() {
  for (int i = 0; i < 2000; ++i) primes[i] = true;
  primes[0] = false;
  primes[1] = false;
  for (int i = 2; i * i <= 2000; ++i) {
    if (primes[i]) {
      for (int j = 2 * i; j <= 2000; j += i) primes[j] = false;
    }
  }
}
bool isPrime(long long int n) {
  if (n == 1 || n == 0) return false;
  if (n == 2 || n == 3) return true;
  for (long long int i = 2; i <= sqrt(n); ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
const int N = 10000005;
int phi[N];
void Totient() {
  phi[0] = 0;
  phi[1] = 1;
  for (int i = 2; i <= N; ++i) phi[i] = i;
  for (int i = 2; i <= N; ++i) {
    if (phi[i] == i) {
      for (int j = i; j <= N; j += i) phi[j] -= (phi[j] / i);
    }
  }
}
bool PermutationChecker(long long int first, long long int second) {
  int arr[10];
  memset(arr, 0, sizeof(arr));
  while (first > 0) {
    arr[first % 10]++;
    first /= 10;
  }
  while (second > 0) {
    arr[second % 10]--;
    second /= 10;
  }
  for (int i = 0; i < 10; ++i) {
    if (arr[i] != 0) return false;
  }
  return true;
}
int main() {
  int test = 1;
  while (test--) {
    int n, q;
    cin >> n >> q;
    int a[31];
    memset(a, 0, sizeof(a));
    long long int arr[n];
    for (int i = 0; i < n; ++i) {
      cin >> arr[i];
      for (int j = 30; j >= 0; --j) {
        if (arr[i] & (1ll * (1 << j))) {
          a[j]++;
          break;
        }
      }
    }
    while (q--) {
      long long int b;
      int temparr[31], barr[31];
      memset(barr, 0, sizeof(barr));
      for (int i = 0; i <= 30; ++i) temparr[i] = a[i];
      cin >> b;
      for (int i = 30; i >= 0; --i) {
        if (b & (1ll * (1 << i))) barr[i] = 1;
      }
      int ans = -1;
      for (int i = 30; i >= 0; --i) {
        if (barr[i] == 1) {
          long long int rem = 1ll * (1 << i);
          for (int j = i; j >= 0; --j) {
            if (rem == 0) break;
            if (temparr[j] != 0) {
              if (1ll * (1 << j) * temparr[j] >= rem) {
                int tempo = (rem / (1ll * (1 << j)));
                if (ans == -1) ans = 0;
                ans += tempo;
                temparr[j] -= tempo;
                rem = 0;
                continue;
              } else {
                rem -= (1ll * (1 << j) * temparr[j]);
                if (ans == -1) ans = 0;
                ans += temparr[j];
                temparr[j] = 0;
              }
            }
          }
          if (rem != 0) {
            ans = -1;
            break;
          }
        }
      }
      cout << ans << endl;
    }
  }
  return 0;
}
