#include <bits/stdc++.h>
long long a[2000010], b;
int f[2000010], g[2000010], i, j, n, q, x, ans;
int main() {
  scanf("%d%d\n", &n, &q);
  for (i = 1; i <= n; ++i) scanf("%I64d", &a[i]), a[i + n] = a[i];
  for (i = 1; i <= n + n; ++i) a[i] += a[i - 1];
  for (i = 1; i <= q; ++i) {
    scanf("%I64d\n", &b);
    x = 0;
    ans = n;
    if (a[n] <= b) ans = 1;
    for (j = 1; j <= n + n; ++j) {
      for (; a[j] - a[x] > b; ++x)
        ;
      f[j] = f[x] + 1;
      if (!x)
        g[j] = j;
      else
        g[j] = g[x];
      if (j - g[j] >= n) ans = std::min(ans, f[j] - f[g[j]]);
    }
    printf("%d\n", ans);
  }
}
