#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000005;
int a[maxn], f[maxn], cnt[maxn];
long long s[maxn];
long long Solve(int n, long long b) {
  int j = 1;
  for (int i = n + 1; i <= n + n; i++) {
    while (s[i] - s[j] > b) j++;
    f[i] = f[j];
    cnt[i] = cnt[j] + 1;
    if (i - f[i] >= n) return cnt[i];
  }
}
int main() {
  int n, q;
  long long b;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
    f[i] = i;
  }
  for (int i = 1; i <= n + n; i++) {
    s[i] = s[i - 1] + a[i];
  }
  while (q--) {
    scanf("%I64d", &b);
    printf("%I64d\n", Solve(n, b));
  }
  return 0;
}
