#include <bits/stdc++.h>
using namespace std;
long long x, sum[2000020];
int n, Q, p, nxt[2000020], w[2000020], go[2000020];
void dfs(int x, int p) {
  if (x - p >= n) {
    w[x] = 0;
    go[x] = x;
    return;
  }
  if (w[x]) {
    dfs(go[x], p);
    w[x] += w[go[x]];
    go[x] = go[go[x]];
  } else {
    dfs(nxt[x], p);
    w[x] = 1 + w[nxt[x]];
    go[x] = go[nxt[x]];
  }
}
int qiu(long long x) {
  p = 1;
  int ret = (1 << 30);
  for (int i = 1; i <= (n << 1); ++i) {
    while (p < (n << 1) && sum[p + 1] - sum[i - 1] <= x) ++p;
    nxt[i] = p + 1;
  }
  for (int i = 1; i <= (n << 1); ++i) w[i] = 0;
  for (int i = 1; i <= n; ++i) {
    dfs(i, i);
    ret = min(ret, w[i]);
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &Q);
  for (int i = 1; i <= n; ++i) scanf("%I64d", &sum[i]);
  for (int i = 1; i <= n; ++i) sum[i + n] = sum[i];
  for (int i = 1; i <= (n << 1); ++i) sum[i] += sum[i - 1];
  for (int i = 1; i <= Q; ++i) {
    scanf("%I64d", &x);
    printf("%d\n", qiu(x));
  }
  return 0;
}
