#include <bits/stdc++.h>
using namespace std;
const int MaxN = 2000010, Step = 7;
long long Sum[MaxN], B;
int A[MaxN], N, To[MaxN], Time[MaxN], F[MaxN];
int Solve(int S) {
  int Last = S - 1, Ret = 0;
  while (Last < S + N - 1) {
    Ret++;
    F[Ret] = To[Last + 1];
    Last = To[Last + 1];
  }
  F[Ret] = min(F[Ret], S + N - 1);
  return Ret;
}
int main() {
  srand(19980310);
  int Q;
  scanf("%d%d", &N, &Q);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
    A[i + N] = A[i];
  }
  for (int i = 1; i <= N * 2; i++) Sum[i] = Sum[i - 1] + A[i];
  while (Q--) {
    cin >> B;
    for (int i = 1; i <= N * 2; i++) {
      To[i] = max(To[i - 1], i);
      while ((To[i] <= N * 2) && (Sum[To[i] + 1] - Sum[i - 1] <= B)) To[i]++;
    }
    int P = Solve(1), Min = N, Pos = 1;
    for (int i = 2; i < P; i++)
      if (F[i] - F[i - 1] <= Min) {
        Min = F[i] - F[i - 1];
        Pos = i;
      }
    int L = F[Pos - 1], R = F[Pos];
    for (int i = L; i <= R; i++) P = min(Solve(i), P);
    cout << P << endl;
  }
  return 0;
}
