#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3000000;
int a[MAXN];
long long sum[MAXN + 1];
int to[MAXN];
int dp[MAXN];
int last[MAXN];
long long getsum(int l, int r) { return sum[r + 1] - sum[l]; }
const int INF = 1000000000;
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 0; i < (n); i++) scanf("%d", &a[i]);
  for (int i = 0; i < (n); i++) a[i + n] = a[i];
  for (int i = 0; i < (2 * n); i++) sum[i + 1] = sum[i] + a[i];
  while (q--) {
    long long b;
    scanf("%lld", &b);
    int rb = 0;
    for (int i = 0; i < n; i++) {
      while (rb < 2 * n && getsum(i, rb) <= b) rb++;
      to[i] = rb - 1;
    }
    for (int i = 0; i <= n; i++) {
      dp[i + n] = 0;
      last[i + n] = i + n;
    }
    for (int i = n - 1; i >= 0; i--) {
      dp[i] = dp[to[i] + 1] + 1;
      last[i] = last[to[i] + 1];
    }
    int res = INF;
    for (int i = 0; i < n; i++) {
      int cnt = dp[i];
      if (last[i] < n + i) {
        if (getsum(last[i], n + i - 1) <= b)
          cnt++;
        else
          cnt = INF;
      }
      res = min(res, cnt);
    }
    printf("%d\n", res);
  }
  return 0;
}
