#include <bits/stdc++.h>
using namespace std;
int first[2000006], f[2000006], a[2000006], n, q;
long long sum[2000006];
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
  }
  for (int i = 1; i <= n + n; i++) sum[i] = sum[i - 1] + a[i];
  for (; q; q--) {
    long long lim;
    scanf("%I64d", &lim);
    for (int i = 1; i <= n + n; i++) first[i] = i, f[i] = 0;
    int ans = n;
    for (int i = 1 + n, j = 1; i <= n + n; i++) {
      for (; sum[i] - sum[j - 1] > lim; j++)
        ;
      first[i] = first[j - 1];
      f[i] = f[j - 1] + 1;
      if (i - first[i] >= n) ans = min(ans, f[i]);
    }
    printf("%d\n", ans);
  }
}
