#include <bits/stdc++.h>
using namespace std;
long long n, q, i, j, s, mn, displacement, b, k, a;
long long A[1000001], E[1000001];
int main() {
  scanf("%I64d%I64d", &n, &q);
  for (i = 0; i < n; i++) scanf("%I64d", &A[i]);
  a = accumulate(A, A + n, 0ll);
  while (q--) {
    scanf("%I64d", &b);
    if (b >= a) {
      printf("1\n");
      continue;
    }
    mn = n;
    for (i = j = s = 0; i < n; i++) {
      while (s + A[j] <= b) {
        s += A[j];
        j = (j + 1) % n;
      }
      E[i] = j;
      s -= A[i];
      if ((E[i] - i + n) % n < mn) {
        k = i;
        mn = (E[i] - i + n) % n;
      }
    }
    mn = n;
    for (j = k;; j++) {
      for (i = j, s = displacement = 0; displacement < n; i = E[i], s++)
        displacement += (E[i] - i + n) % n;
      mn = min(mn, s);
      if (j == E[k]) break;
    }
    printf("%I64d\n", mn);
  }
  return 0;
}
