#include <bits/stdc++.h>
using namespace std;
long long int ar[500009], br[500009];
int main() {
  long long int a, b, c, i, j = 1, k, y, z, x;
  cin >> a >> b;
  for (i = 1; i <= a; i++) {
    cin >> ar[i];
  }
  br[1] = ar[1];
  for (i = 2; i <= a; i++) {
    if (ar[i] != ar[i - 1]) {
      br[++j] = ar[i];
    }
  }
  sort(br + 1, br + j + 1);
  for (i = 1; i <= b; i++) {
    cin >> c;
    y = 0;
    z = 0;
    x = 0;
    for (k = j; k > 0; k--) {
      if (x + br[k] <= c) {
        x = x + br[k];
        y++;
      }
      if (x == c) {
        z = 1;
        cout << y << endl;
        break;
      }
    }
    if (z == 0) {
      cout << "-1" << endl;
    }
  }
}
