#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
long long n, q, a[1000005], pre[1000005];
long long dis(long long x, long long y) {
  x -= y;
  return x < 0 ? x + n : x;
}
int main() {
  scanf("%lld%lld", &n, &q);
  long long sum = 0;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    sum += a[i];
  }
  for (long long i = 0; i < q; i++) {
    long long b;
    scanf("%lld", &b);
    if (b >= sum) {
      puts("1");
      continue;
    }
    long long now = 1, cnt = 0, id = -1, mx = 1000000000;
    for (long long j = 1; j <= n; j++) {
      while (cnt <= b) {
        cnt += a[now];
        now++;
        if (now > n) now -= n;
      }
      now--;
      if (now <= 0) now += n;
      cnt -= a[now];
      pre[j] = dis(now, j);
      if (pre[j] < mx) {
        mx = pre[j];
        id = j;
      }
      cnt -= a[j];
    }
    long long ans = 1000000000;
    for (long long j = id; j <= id + mx; j++) {
      long long now = j, cnt = 0, lastdis = 0;
      while (now > n) now -= n;
      while (true) {
        now = now + pre[now];
        if (now > n) now -= n;
        cnt++;
        if (dis(now, j) < lastdis) break;
        lastdis = dis(now, j);
      }
      ans = min(ans, cnt);
    }
    printf("%lld\n", ans);
  }
  return 0;
}
