#include <bits/stdc++.h>
using namespace std;
using namespace std;
int n, Q;
int a[1000514];
int g[1000514];
long long int d[1000514];
int dp[1000514];
long long int s[1000514];
int ans;
void sol() {
  int mod = 2;
  for (int i = 0; i < n; i++) {
    scanf("%d", &(a[i]));
    s[i] = (i ? s[i - 1] : 0) + a[i];
  }
  for (int q = 1; q <= Q; q++) {
    long long int b;
    scanf("%I64d", &(b));
    long long int ts = 0;
    for (int i = 0, qe = 0; i < n; i++) {
      if (i) {
        ts -= a[i - 1];
      }
      for (; qe < n && ts + a[qe] <= b; qe++) {
        ts += a[qe];
      }
      g[i] = qe;
    }
    g[n] = n;
    dp[n] = 0;
    for (int i = n - 1; i >= 0; i--) {
      dp[i] = dp[g[i]] + 1;
      if (g[i] == n) {
        d[i] = s[n - 1] - (i ? s[i - 1] : 0);
      } else {
        d[i] = d[g[i]];
      }
    }
    ans = dp[0];
    ts = 0;
    for (int i = 1; i < n; i++) {
      ts += a[i - 1];
      if (ts > b) break;
      ans = min(ans, dp[i] + 1 - (ts + d[i] <= b));
    }
    printf("%d\n", ans);
  }
  fprintf(stderr, "ok\n");
}
int main() {
  while (scanf("%d %d", &(n), &(Q)) != EOF) sol();
  return 0;
}
