#include <bits/stdc++.h>
const int N = 2 * (1e6) + 1;
using namespace std;
long long n, m, i, j, l, ans, a[N], sum[N], fi[N], f[N];
int main() {
  scanf("%I64d%I64d\n", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    a[n + i] = a[i];
  }
  for (i = 1; i <= n + n; i++) sum[i] = sum[i - 1] + a[i];
  for (i = 1; i <= n; i++) fi[i] = i, f[i] = 0;
  for (scanf("\n"); m--;) {
    scanf("%I64d\n", &l);
    ans = 1e9;
    for (i = n + 1, j = 1; i <= n + n; i++) {
      for (; sum[i] - sum[j - 1] > l; j++)
        ;
      fi[i] = fi[j - 1];
      f[i] = f[j - 1] + 1;
      if (i - fi[i] >= n) ans = min(ans, f[i]);
    }
    printf("%I64d\n", ans);
  }
}
