#include <bits/stdc++.h>
using namespace std;
int n;
long long val[2001000];
int f[2001000], pre[2001000];
void getans(long long F) {
  for (int i = 1; i <= n + n; i++) f[i] = 0, pre[i] = i;
  int pl = 1;
  int ans = 0x7fffffff;
  for (int i = n + 1; i <= n + n; i++) {
    while (pl < i && val[i] - val[pl] > F) pl++;
    f[i] = f[pl] + 1;
    pre[i] = pre[pl];
    if (i - pre[i] >= n) ans = min(ans, f[i]);
  }
  printf("%d\n", ans);
}
void solve() {
  int q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%lld", &val[i]), val[i + n] = val[i];
  for (int i = 2; i <= n + n; i++) val[i] += val[i - 1];
  for (int i = 1; i <= q; i++) {
    long long t;
    scanf("%lld", &t);
    getans(t);
  }
}
int main() {
  solve();
  fclose(stdin);
  fclose(stdout);
  return 0;
}
