#include <bits/stdc++.h>
using namespace std;
int n, q;
long long sum[2000099], k;
int fa[2000099], ans[2000099], a[2000099];
int read() {
  int x = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x;
}
int main() {
  sum[0] = 0LL;
  n = read(), q = read();
  for (int i = 1; i <= n; i++) a[i] = read(), fa[i] = i, a[i + n] = a[i];
  for (int i = 1; i <= 2 * n; i++) sum[i] = sum[i - 1] + a[i];
  for (int i = 1; i <= q; i++) {
    scanf("%I64d", &k);
    int pos = 1;
    for (int j = n + 1; j <= n * 2; j++) {
      while (sum[j] - sum[pos] > k) ++pos;
      fa[j] = fa[pos];
      ans[j] = ans[pos] + 1;
      if (j - fa[j] >= n) {
        printf("%d\n", ans[j]);
        break;
      }
    }
  }
  return 0;
}
