#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);
const int MAXN = 2e6 + 5;
const int MOD = 1e9 + 7;
int sgn(double x) {
  if (fabs(x) < eps) return 0;
  if (x < 0)
    return -1;
  else
    return 1;
}
long long pw(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int n, q, a[MAXN], L[MAXN], dp[MAXN];
long long sum[MAXN];
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++)
    scanf("%d", &a[i]), a[i + n] = a[i], L[i] = i, dp[i] = 0;
  for (int i = 1; i <= 2 * n; i++) sum[i] = sum[i - 1] + a[i];
  long long b;
  while (q--) {
    scanf("%I64d", &b);
    for (int i = n + 1, j = 1; i <= 2 * n; i++) {
      while (sum[i] - sum[j] > b) j++;
      L[i] = L[j], dp[i] = dp[j] + 1;
      if (i - L[i] >= n) {
        printf("%d\n", dp[i]);
        break;
      }
    }
  }
}
