#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)2e6 + 10;
const int logn = 19;
int a[maxn];
long long sum[maxn];
int ne[logn + 1][maxn];
int n, q;
long long lim;
inline long long Sum(int l, int r) {
  long long ans = sum[r];
  if (l > 0) ans -= sum[l - 1];
  return ans;
}
void Solve() {
  int j = 0;
  for (int i = 0; i < n + n; ++i) {
    if (j < i) j = i;
    while (j < n + n && Sum(i, j) <= lim) ++j;
    ne[0][i] = j;
  }
  ne[0][n + n] = n + n;
  for (int k = 1; k <= logn; ++k) {
    for (int i = 0; i < n + n; ++i) {
      ne[k][i] = ne[k - 1][ne[k - 1][i]];
    }
    ne[k][n + n] = n + n;
  }
  int ans = n;
  int till = min(n - 1, ne[0][0]);
  for (int i = 0; i <= till; ++i) {
    int cur = 1, t = i;
    for (int k = logn; cur < ans && k >= 0; --k) {
      if (ne[k][t] < n + i) {
        t = ne[k][t];
        cur += (1 << k);
      }
    }
    ans = min(ans, cur);
  }
  printf("%d\n", 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 < n + n; ++i) {
    sum[i] = a[i];
    if (i > 0) sum[i] += sum[i - 1];
  }
  for (int i = 0; i < q; ++i) {
    cin >> lim;
    Solve();
  }
  return 0;
}
