#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000000 + 10;
int a[MAXN * 2];
int from[MAXN * 2], ans[MAXN * 2];
long long ss[MAXN * 2];
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
    from[i] = i;
    ans[i] = 0;
  }
  for (int i = 1; i <= 2 * n; i++) ss[i] = ss[i - 1] + a[i];
  for (int Q = 1; Q <= q; Q++) {
    int lim;
    scanf("%d", &lim);
    memset(ans, 0, sizeof(ans));
    int j = 1;
    for (int i = n + 1; i <= 2 * n; i++) {
      while (ss[i] - ss[j] > lim) j++;
      ans[i] = ans[j] + 1;
      from[i] = from[j];
      if (i - from[i] >= n) {
        printf("%d\n", ans[i]);
        break;
      }
    }
  }
}
