#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6 + 100, INF = 1e18;
int n, q, ans, nxt[N];
long long a[N], b;
inline int find_ans(int dex) {
  int res = 0;
  for (int i = dex; i < dex + n; i = nxt[i]) {
    ++res;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  copy(a, a + n, a + n);
  a[2 * n] = INF;
  while (q--) {
    cin >> b;
    int ans = N, dex = 0, mini = N;
    long long l = 0, r = 0, sum = 0;
    while (l < n) {
      while (sum <= b) {
        sum += a[r++];
      }
      while (sum > b) {
        nxt[l] = r - 1;
        if (nxt[l] - l < mini) {
          mini = nxt[l] - l;
          dex = l;
        }
        sum -= a[l++];
      }
    }
    for (int i = n; i < 2 * n; ++i) {
      nxt[i] = nxt[i - n] + n;
    }
    for (int i = dex; i <= nxt[dex]; ++i) {
      ans = min(ans, find_ans((i < n ? i : i - n)));
    }
    cout << ans << '\n';
  }
}
