#include <bits/stdc++.h>
using namespace std;
const long long CN = 2e6 + 6;
const long long INF = 0x3f3f3f3f3f3f3f3f;
long long read() {
  long long s = 0, ne = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') ne = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') s = (s << 1) + (s << 3) + c - '0', c = getchar();
  return s * ne;
}
long long n, q, k, a[CN], sum[CN], f[CN], g[CN];
signed main() {
  n = read(), q = read();
  for (long long i = 1; i <= n; i++) a[i + n] = a[i] = read();
  for (long long i = 1; i <= (n << 1); i++) sum[i] = sum[i - 1] + a[i];
  while (q--) {
    k = read(), f[1] = g[1] = 1;
    long long cur = a[1];
    for (long long i = 2; i <= (n << 1); i++)
      if (cur + a[i] <= k)
        cur += a[i], f[i] = f[i - 1];
      else
        cur = a[i], f[i] = f[i - 1] + 1, g[f[i]] = i;
    long long ans = INF;
    for (long long i = 1; i <= n; i++) {
      long long j = i + n - 1, cnt = f[j] - f[i] + 1, pre, suf;
      if (cnt == 1)
        ans = 1;
      else {
        pre = sum[g[f[i] + 1] - 1] - sum[i - 1],
        suf = sum[j] - sum[g[f[j]] - 1];
        ans = min(ans, cnt - (pre + suf <= k));
      }
    }
    printf("%d", ans), puts("");
  }
  return 0;
}
