#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
int a[N], nx[N];
long long pr[N];
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i + n] = a[i];
  for (int i = 1; i <= n + n; i++) pr[i] = pr[i - 1] + a[i];
  while (q--) {
    long long b;
    scanf("%lld", &b);
    int now = 1;
    int mx = n + n + 1, id;
    for (int i = 1; i <= n + n; i++) {
      while (now <= n + n && pr[i - 1] + b >= pr[now]) now++;
      nx[i] = now;
      if (nx[i] - i >= n) nx[i] = i + n;
      if (nx[i] <= n + n && mx > nx[i] - i) {
        mx = nx[i] - i;
        id = i;
      }
    }
    int ans = n + n;
    for (int i = id; i < nx[id]; i++) {
      int p = i;
      int res = 0;
      while (p < i + n) {
        res++;
        if (nx[p] > i + n && res > 1) {
          if (pr[i + n - 1] - pr[p - 1] + pr[nx[i] - 1] - pr[i - 1] <= b) res--;
        }
        p = nx[p];
      }
      ans = min(ans, res);
    }
    printf("%d\n", ans);
  }
}
