#include <bits/stdc++.h>
using std::cin;
using std::cout;
const int N = 2002000;
int n, q;
long long a[N], pre[N];
int go[N];
int head[N], next[N];
int st[N], top, succ, ans;
inline void dfs0(int x) {
  st[++top] = x;
  if (top >= ans) succ = succ || st[top - (ans - 1)] >= x + n;
  for (int& i = head[x]; i; i = next[i]) dfs0(i);
  --top;
}
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> q;
  for (int i = (1), iend = (n); i <= iend; ++i) cin >> a[i], a[i + n] = a[i];
  for (int i = (1), iend = (n + n); i <= iend; ++i) pre[i] = pre[i - 1] + a[i];
  for (int i = (1), iend = (q); i <= iend; ++i) {
    long long w;
    cin >> w;
    for (int i = 1, p = 1; i <= n + n; ++i) {
      for (; p <= n + n && pre[p] - pre[i - 1] <= w;) ++p;
      go[i] = p;
      next[i] = head[p], head[p] = i;
    }
    succ = ans = 0;
    for (int x = 1; x <= n; x = go[x]) ++ans;
    dfs0(n + n + 1);
    cout << ans - succ << '\n';
  }
}
