#include <bits/stdc++.h>
using namespace std;
int nxt[2001000], n, Q, a[2001000];
int calc(int x) {
  int res = 0;
  for (int now = x; now < x + n;) res++, now = nxt[now] + 1;
  return res;
}
void solve(int x) {
  int minn = 0x3f3f3f3f, id = 0;
  for (int i = 1, j = 1, sum = a[1]; i <= n; i++) {
    while (sum + a[j + 1] <= x && j + 1 < i + n) j++, sum += a[j];
    nxt[i] = j;
    if (nxt[i] - i < minn) minn = nxt[i] - i, id = i;
    sum -= a[i];
  }
  for (int i = n + 1; i <= 2 * n; i++) nxt[i] = nxt[i - n] + n;
  int res = 0x3f3f3f3f;
  for (int i = id; i <= nxt[id] + 1; i++) res = min(res, calc((i - 1) % n + 1));
  printf("%d\n", res);
}
int main() {
  scanf("%d%d", &n, &Q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = n + 1; i <= 2 * n; i++) a[i] = a[i - n];
  while (Q--) {
    int x;
    scanf("%d", &x);
    solve(x);
  }
}
