#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 10;
long long data[N * 2], sum[N * 2];
int last[N * 2], f[N * 2];
struct AC_IO {
  long long read() {
    char c = getchar();
    while (!isdigit(c)) c = getchar();
    long long x = 0ll;
    while (isdigit(c)) {
      x = x * 10ll + c - '0';
      c = getchar();
    }
    return x;
  }
} acfox;
int main() {
  int n, q;
  long long val;
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) data[i] = acfox.read(), data[i + n] = data[i];
  for (int i = 1; i <= n * 2; i++) sum[i] = sum[i - 1] + data[i];
  for (int i = 1; i <= n; i++) last[i] = i;
  for (int i = 1; i <= q; i++) {
    val = acfox.read();
    int pos = 1;
    for (int j = n + 1; j <= n + n; j++) {
      while (sum[j] - sum[pos] > val) pos++;
      last[j] = last[pos];
      f[j] = f[pos] + 1;
      if (j - last[j] >= n) {
        printf("%d\n", f[j]);
        break;
      }
    }
  }
  return 0;
}
