#include <bits/stdc++.h>
using namespace std;
int a[888], divi[888], mod[888], r[888], Q, n, ck[66], all;
char v[1 << 26 + 1];
pair<long long, long long> T[2121];
int trans(int x) {
  if (x == 1 << 27) return 27;
  return v[x];
}
long long query(long long x) {
  long long now = x, i, res = 0;
  for (i = 0; i < 28; i++) ck[i] = 0;
  all = 0;
  for (i = 0; i < n; i++) {
    int d = divi[r[i]], m = mod[r[i]];
    if (!ck[d]) all ^= (1 << d);
    ck[d] += (1 << m);
    now += a[i];
    while (now < 0) {
      int ld = trans(all & -all), lm = trans(ck[ld] & -ck[ld]);
      now -= T[ld * 28 + lm].first;
      res++;
      ck[ld] -= (1 << lm);
      if (!ck[ld]) all ^= (1 << ld);
    }
  }
  return res;
}
int main() {
  long long m, i, j;
  scanf("%lld%lld", &n, &m);
  for (i = 0; i < 27; i++) v[1 << i] = i;
  for (i = 0; i < n; i++) scanf("%d", &a[i]), T[i] = {a[i], i};
  for (i = 0; i < n; i++) divi[i] = i / 28, mod[i] = i % 28;
  sort(T, T + n);
  for (i = 0; i < n; i++) r[T[i].second] = i;
  for (long long i = 0; i < m; i++) {
    long long x;
    scanf("%lld", &x);
    printf("%lld\n", query(x));
  }
  return 0;
}
