#include <bits/stdc++.h>
using namespace std;
int p[4000100];
long long int sum[4000100], q[4000100];
int i, j, n, mm;
long long int m;
inline void make() {
  p[n + n + n + n] = n + n + n + n;
  sum[n + n + n + n] = q[n + n + n + n];
  for (i = n + n + n + n - 1; i; i--) {
    sum[i] = sum[i + 1] + q[i];
    p[i] = p[i + 1];
    while (sum[i] > m) {
      sum[i] -= q[p[i]];
      p[i]--;
    }
  }
  int nowmin = -1;
  for (i = n + 1; i <= n + n; i++) {
    if (p[i - 1] >= p[i]) continue;
    if (nowmin < 0)
      nowmin = i;
    else {
      if (p[i] - i < p[nowmin] - nowmin) {
        nowmin = i;
      }
    }
  }
  int ans = n;
  if (nowmin < 0) nowmin = n + 1;
  if (p[nowmin] - nowmin >= n - 1) {
    cout << 1 << endl;
    return;
  }
  for (i = nowmin; i <= p[nowmin]; i++) {
    j = i;
    int now = 0;
    while (j < i + n) {
      j = p[j] + 1;
      now++;
    }
    if (now < ans) ans = now;
  }
  cout << ans << endl;
}
int main() {
  cin.sync_with_stdio(false);
  cin >> n >> mm;
  for (i = 1; i <= n; i++) {
    cin >> q[i];
    q[i + n] = q[i + n + n + n] = q[i + n + n] = q[i];
  }
  while (mm--) {
    cin >> m;
    make();
  }
  return 0;
}
