#include <bits/stdc++.h>
using namespace std;
int N;
int a[1000010];
long long s[2000010];
int r[2000010], l[2000010];
int to_r[2000010], step_r[2000010];
int to_l[2000010], step_l[2000010];
int func(long long X) {
  int i, j;
  j = 0;
  for ((i) = 0; (i) < (int)(2 * N + 1); (i)++) {
    while (j < 2 * N && s[j + 1] - s[i] <= X) j++;
    r[i] = j;
  }
  j = 2 * N;
  for (i = 2 * N; i >= 0; i--) {
    while (j > 0 && s[i] - s[j - 1] <= X) j--;
    l[i] = j;
  }
  for (i = N; i >= 0; i--) {
    if (r[i] > N) {
      to_r[i] = i;
      step_r[i] = 0;
    } else {
      to_r[i] = to_r[r[i]];
      step_r[i] = step_r[r[i]] + 1;
    }
  }
  for (i = N; i <= 2 * N; i++) {
    if (l[i] < N) {
      to_l[i] = i;
      step_l[i] = 0;
    } else {
      to_l[i] = to_l[l[i]];
      step_l[i] = step_l[l[i]] + 1;
    }
  }
  int ans = N;
  for ((i) = 0; (i) < (int)(N + 1); (i)++) {
    int tmp = step_r[i] + step_l[N + i];
    int L = to_r[i];
    int R = to_l[N + i];
    if (s[R] - s[L] > X) {
      tmp += 2;
    } else if (R != L) {
      tmp++;
    }
    ans = min(ans, tmp);
  }
  return ans;
}
int main(void) {
  int Q, i;
  cin >> N >> Q;
  for ((i) = 0; (i) < (int)(N); (i)++) scanf("%d", &a[i]);
  for ((i) = 0; (i) < (int)(2 * N); (i)++) s[i + 1] = s[i] + a[i % N];
  for ((i) = 0; (i) < (int)(Q); (i)++) {
    long long X;
    cin >> X;
    int ans = func(X);
    cout << ans << endl;
  }
  return 0;
}
