#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
const int INF = (int)1e9 + 1;
const long double EPS = 1e-9;
const int maxn = (int)1e6 + 10;
int a[maxn * 2];
long long sum[2 * maxn + 1];
int go[maxn * 2];
int solve(int n, long long b) {
  if (sum[n] <= b) {
    return 1;
  }
  int mnv = 0;
  for (int i = 0, j = 0; i < n; ++i) {
    while (j < i + n && sum[j + 1] - sum[i] <= b) {
      ++j;
    }
    go[i] = j;
    go[i + n] = j + n;
    if (go[mnv] - mnv > go[i] - i) {
      mnv = i;
    }
  }
  int res = INF;
  for (int pos = mnv + 1; pos <= go[mnv]; ++pos) {
    int v0 = pos >= n ? pos - n : pos;
    int value = 0;
    for (int v = v0; v < v0 + n; v = go[v], ++value)
      ;
    res = min(res, value);
  }
  return res;
}
bool solve() {
  int n, q;
  if (scanf("%d%d", &n, &q) < 2) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
  }
  sum[0] = 0;
  for (int i = 0; i < 2 * n; ++i) {
    sum[i + 1] = sum[i] + a[i];
  }
  for (int t = 0; t < q; ++t) {
    long long b;
    scanf("%lld", &b);
    printf("%d\n", solve(n, b));
  }
  return 1;
}
int main() {
  srand(rdtsc());
  while (1) {
    if (!solve()) {
      break;
    }
  }
  return 0;
}
