#include <bits/stdc++.h>
using namespace std;
mt19937 mt_rand(chrono::system_clock::now().time_since_epoch().count());
const int P = 31;
const int mod = (int)1e9 + 7;
const int maxn = (int)3e6;
int n;
int a[maxn];
int f[maxn];
int to[maxn];
void go(int l, int r) {
  if (to[l] < r) {
    go(to[l], r);
    f[l] += f[to[l]];
    to[l] = to[to[l]];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[n + i] = a[i];
  }
  while (q--) {
    long long bound;
    cin >> bound;
    long long s = 0;
    int ptr = 2 * n - 1;
    for (int i = 2 * n - 1; i >= 0; i--) {
      s += a[i];
      while (s > bound) {
        s -= a[ptr];
        ptr--;
      }
      to[i] = ptr + 1;
      f[i] = 1;
    }
    int ans = n;
    for (int i = 0; i < n; i++) {
      go(i, i + n);
      ans = min(ans, f[i]);
    }
    cout << ans << "\n";
  }
  return 0;
}
