#include <bits/stdc++.h>
using namespace std;
const int Maxn = 3000000;
int a[Maxn], nx[Maxn], ls[Maxn], n, q;
long long w;
long long check(long long ind) {
  int len = 0, ted = 0;
  while (len < n) {
    len += nx[ind] - ind;
    ind = nx[ind] % n;
    ted++;
  }
  return ted;
}
void find_seg() {
  fill(ls, ls + n, -1);
  long long sum = 0, j = 0;
  for (int i = 0; i < n; i++) {
    while (sum + a[j] <= w && j < i + n) {
      sum += a[j];
      j++;
    }
    nx[i] = j;
    if (i && nx[i] != nx[i - 1]) ls[i] = i;
    sum -= a[i];
  }
  if (nx[0] + n > nx[n - 1]) ls[0] = 0;
}
int solve() {
  find_seg();
  long long mini = n, ind = 0, ted = 0, j = 0;
  for (int i = 0; i < n; i++)
    if (ls[i] == i) {
      while (j < nx[i]) {
        if (ls[j % n] == j % n) ted++;
        j++;
      }
      if (ted < mini) mini = ted, ind = i;
      ted--;
    }
  long long ans = n;
  for (long long k = ind; k < nx[ind]; k++)
    if (ls[k % n] == k % n) ans = min(check(k % n), ans);
  return ans;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]), a[i + n] = a[i];
  for (int i = 0; i < q; i++) {
    scanf("%I64d", &w);
    printf("%d\n", solve());
  }
  return 0;
}
