#include <bits/stdc++.h>
using namespace std;
long long n, q, b;
long long a[2000009];
long long nxt[2000009];
long long pre[2000009];
long long calc(long long cur, long long beg) {
  if (cur >= n + beg)
    return 0;
  else
    return 1 + calc(nxt[cur], beg);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> q;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    a[n + i] = a[i];
  }
  for (long long i = 1; i <= 2 * n; ++i) pre[i] = pre[i - 1] + a[i];
  while (q--) {
    cin >> b;
    long long j = 1;
    long long mini = 1e18;
    long long place = -1;
    for (long long i = 1; i <= 2 * n; ++i) {
      while (j <= 2 * n && pre[j] - pre[i - 1] <= b) ++j;
      if (i <= n && j - i <= mini) {
        mini = j - i;
        place = i;
      }
      nxt[i] = j;
    }
    long long ans = 1e18;
    long long endi = nxt[place];
    for (long long i = place; i <= endi; ++i) {
      if (i > n) {
        i -= n;
        endi -= n;
      }
      ans = min(ans, calc(i, i));
    }
    cout << ans << "\n";
  }
}
