#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6 + 10, inf = 1e14;
long long n, q, a[N], nxt[N];
long long answer(long long b) {
  long long sum = 0, pos = 1;
  for (long long i = 1; i <= 2 * n; i++) {
    while (pos <= 2 * n && sum + a[pos] <= b) sum += a[pos++];
    nxt[i] = pos;
    sum -= a[i];
  }
  long long arc = inf;
  for (long long i = 1; i <= n; i++) arc = min(arc, nxt[i] - i);
  ;
  long long x = 1;
  for (long long i = 1; i <= n; i++)
    if (nxt[i] - i == arc) {
      x = i;
      break;
    }
  long long ans = inf;
  for (long long fi = x; fi <= nxt[x]; fi++) {
    long long chi = fi;
    if (chi > n) chi -= n;
    long long now = chi, tim = 0;
    while (now < chi + n) {
      now = nxt[now], ++tim;
    }
    ans = min(ans, tim);
    ;
  }
  return ans;
}
int main() {
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) cin >> a[i], a[i + n] = a[i];
  while (q--) {
    long long b;
    cin >> b;
    cout << answer(b) << '\n';
  }
}
