#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000010, inf = 1e9;
int niz[MAXN], a[MAXN], dp[MAXN], preko[MAXN];
int n, q;
long long int k;
int rijesi() {
  long long int sad = 0;
  for (int i = 0; i < n - 1; i++) sad += (long long int)niz[i];
  int kraj = n - 2;
  for (int i = n - 1; i >= 0; i--) {
    sad += (long long int)niz[i];
    while (sad > k) {
      sad -= (long long int)niz[kraj];
      kraj = (kraj - 1 + n) % n;
    }
    a[i] = kraj;
  }
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] < i || a[i] == n - 1) {
      dp[i] = 1;
      preko[i] = a[i];
      continue;
    }
    dp[i] = dp[a[i] + 1] + 1;
    preko[i] = preko[a[i] + 1];
  }
  int ret = inf;
  ret = min(ret, dp[0]);
  for (int i = 1; i < n; i++)
    if (preko[i] >= i - 1 && preko[i] != n - 1) ret = min(ret, dp[i]);
  return ret;
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%d", &niz[i]);
  for (int i = 0; i < q; i++) {
    scanf("%I64d", &k);
    printf("%d\n", rijesi());
  }
  return 0;
}
