#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int MAXN = 2000005;
long long a[MAXN], s[MAXN];
long long sp, n, m, mn, lp, ans;
inline void solve(int x) {
  long long tot = 0, num = 0;
  for (int i = x; i <= x + n - 1; i++) {
    tot += a[i];
    if (tot > sp) tot = a[i], num++;
  }
  num++;
  ans = min(ans, num);
}
inline void solve2(int x) {
  long long l, r, mid, nxt, num = 0;
  for (int i = x; i <= x + n - 1; i = nxt + 1, num++) {
    l = i, r = x + n - 1, nxt = i;
    while (l <= r) {
      mid = (l + r) >> 1;
      if (s[mid] - s[i - 1] <= sp)
        nxt = mid, l = mid + 1;
      else
        r = mid - 1;
    }
  }
  ans = min(ans, num);
}
inline void query() {
  long long tot = 0, nowl = 1;
  for (int i = 1; i <= n; i++) {
    tot += a[i];
    if (tot > sp) {
      tot = a[i];
      if (i - nowl < mn) mn = i - nowl, lp = nowl;
      nowl = i;
    }
  }
  for (int i = lp; i <= lp + mn; i++) {
    if (mn <= 12)
      solve(i);
    else
      solve2(i);
  }
}
int main(int argc, char const *argv[]) {
  n = read();
  m = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) a[i + n] = a[i];
  for (int i = 1; i <= 2 * n; i++) s[i] = s[i - 1] + a[i];
  while (m--) {
    sp = read();
    mn = ans = n;
    query();
    printf("%lld\n", ans);
  }
  return 0;
}
