#include <bits/stdc++.h>
int a[2000009];
int b[2000009];
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n - 1; i++) a[i + n] = a[i];
  while (q--) {
    int t;
    scanf("%d", &t);
    int p = 0;
    for (int i = 0, j = 0, sum = 0; i < n; i++) {
      while (j < 2 * n - 1 && a[j] + sum <= t) {
        sum += a[j];
        j++;
      }
      b[i] = j;
      b[i + n] = j + n;
      sum -= a[i];
      if (b[i] - i < b[p] - p) p = i;
    }
    int ans = n;
    for (int i = p; i <= b[p]; i++) {
      int j = i % n;
      int cnt = 0, k = j;
      while (k < j + n) {
        k = b[k];
        cnt++;
      }
      if (cnt < ans) ans = cnt;
    }
    printf("%d\n", ans);
  }
}
