#include <bits/stdc++.h>
using namespace std;
const int N = 4000006;
int n, m, belong[N], eddd[N];
long long a[N], sum[N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) a[i + n] = a[i];
  for (int i = 1; i <= n * 2; i++) sum[i] = sum[i - 1] + a[i];
  for (int i = 1; i <= m; i++) {
    long long K;
    scanf("%lld", &K);
    memset(belong, 0, sizeof(belong));
    memset(eddd, 0, sizeof(eddd));
    long long t = 0;
    belong[1] = 1;
    t = a[1];
    for (int i = 2; i <= 2 * n; i++)
      if (t + a[i] <= K)
        t += a[i], belong[i] = belong[i - 1];
      else
        t = a[i], belong[i] = belong[i - 1] + 1, eddd[belong[i]] = i;
    int ans = n;
    for (int i = 1; i <= n + 1; i++) {
      int t = i + n - 1;
      int cnt = belong[t] - belong[i] + 1;
      long long l, r;
      r = sum[t] - sum[eddd[belong[t]] - 1];
      l = sum[eddd[belong[i] + 1] - 1] - sum[i - 1];
      if (l + r <= K) cnt--;
      ans = min(ans, cnt);
    }
    printf("%d\n", max(1, ans));
  }
}
