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