#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int N, Q, a[1000100 << 1], st[1000100 << 1], cnt[1000100 << 1];
long long sum[1000100 << 1];
int main() {
  N = read(), Q = read();
  for (int i = 1; i <= N; i++) a[i] = a[i + N] = read(), st[i] = i;
  for (int i = 1; i <= 2 * N; i++) sum[i] = sum[i - 1] + a[i];
  while (Q--) {
    long long b = read();
    for (int j = 1, i = N + 1; i <= N * 2; i++) {
      while (sum[i] - sum[j] > b) j++;
      st[i] = st[j];
      cnt[i] = cnt[j] + 1;
      if (i - st[i] >= N) {
        printf("%d\n", cnt[i]);
        break;
      }
    }
  }
  return 0;
}
