#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> a(n), ans(m, 0);
  vector<pair<long long, int>> q(m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < m; i++) {
    scanf("%lld", &q[i].first);
    q[i].second = i;
  }
  sort(q.begin(), q.end());
  for (int cnt = 0, ptr = m - 1; ptr >= 0 && cnt <= n; cnt++) {
    int idx = 0;
    vector<long long> p(n + 1, 0), w(n + 1, 0);
    for (int i = 1; i <= n; i++) {
      p[i] = p[i - 1] + a[i - 1];
      w[i] = min(w[i - 1], p[i]);
      if (p[idx] > p[i]) idx = i;
    }
    for (; ptr >= 0 && q[ptr].first >= -p[idx]; ptr--) ans[q[ptr].second] = cnt;
    long long wst = 0, lvl = -INF;
    for (int i = n - 1; i >= 0; i--) {
      wst = min(wst, p[i + 1]);
      if (lvl <= min(w[i], wst - a[i])) {
        lvl = min(w[i], wst - a[i]);
        idx = i;
      }
    }
    a[idx] = 0;
  }
  for (int i = 0; i < m; i++) printf("%d\n", ans[i]);
}
