#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 21;
int n, q, a[N], f[N], g[N];
long long s[N], b;
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    a[i + n] = a[i];
    g[i] = i + 1;
  }
  for (int i = 1; i <= 2 * n; i++) s[i] = s[i - 1] + a[i];
  while (q--) {
    scanf("%I64d", &b);
    int j = 1;
    bool have = 0;
    for (int i = n + 1; i <= 2 * n; i++) {
      while (s[i] - s[j] > b) j++;
      f[i] = f[j] + 1;
      g[i] = g[j];
      if (i - g[i] + 1 >= n) {
        printf("%d\n", f[i]);
        break;
      }
    }
  }
  return 0;
}
