#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e18;
const int mod = (int)1e9 + 7;
const int MAXN = (int)3e6 + 5;
long long n;
long long a[MAXN], b[MAXN];
long long dp[MAXN];
long long block[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i + n] = a[i];
  }
  while (q--) {
    long long b;
    cin >> b;
    long long l = 0, r = 0;
    long long sum = a[0];
    long long ind = 0;
    while (l < n) {
      while (r + 1 < 2 * n && sum + a[r + 1] <= b) {
        r++;
        sum += a[r];
      }
      block[l] = r - l + 1;
      block[l] = min(block[l], n);
      if (block[l] < block[ind]) ind = l;
      l++;
      sum -= a[l - 1];
    }
    long long ans = INF;
    for (long long i = ind; i <= ind + block[ind]; i++) {
      long long j = i;
      long long cur = 0;
      while (j < i + n) {
        j = j + (j >= n ? block[j - n] : block[j]);
        cur++;
      }
      ans = min(ans, cur);
    }
    cout << ans << '\n';
  }
}
