#include <bits/stdc++.h>
using namespace std;
const int MX = 1000005;
int D[MX * 2];
int T1[MX * 2], R1[MX * 2];
int T2[MX * 2], R2[MX * 2];
int main() {
  int N, Q;
  scanf("%d%d", &N, &Q);
  for (int i = 1; i <= N; i++) scanf("%d", D + i);
  for (int i = 1; i <= N; i++) D[i + N] = D[i];
  for (int t = 1; t <= Q; t++) {
    int A, tot = 0, st = 1;
    scanf("%d", &A);
    T1[0] = T2[0] = 0;
    for (int i = 1; i <= 2 * N; i++) {
      tot += D[i];
      while (st <= i && tot > A) tot -= D[st++];
      T1[i] = T1[st - 1] + 1;
      if (T1[i] == 1)
        R1[i] = tot;
      else
        R1[i] = R1[st - 1];
    }
    tot = 0, st = 1;
    int cnt = 0;
    for (int i = 1; i <= 2 * N; i++) {
      tot += D[i];
      if (tot > A) tot -= A, cnt++;
      T2[i] = cnt;
      R2[i] = tot;
    }
    int ans = N;
    for (int i = 0; i < N; i++) {
      if (R1[i + N] > R2[i])
        ans = min(ans, T1[i + N] - T2[i]);
      else
        ans = min(ans, T1[i + N] - T2[i] - 1);
    }
    printf("%d\n", ans);
  }
}
