#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  long long x = 0;
  bool f = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return f ? -x : x;
}
long long n, m, l[1000010 << 1], f[1000010 << 1], hd[1000010];
int main() {
  n = rd();
  m = rd();
  for (register long long i = 1; i <= n; ++i) l[i] = l[n + i] = rd();
  for (register long long i = 1; i <= (n << 1); ++i) l[i] += l[i - 1];
  while (m--) {
    long long ptr = 0, len = rd();
    for (register long long i = n + 1; i <= (n << 1); ++i) {
      while (l[i] - l[ptr] > len) ++ptr;
      f[i] = f[ptr] + 1;
      hd[i - n] = (i == ptr ? i : (ptr <= n ? ptr : hd[ptr - n]));
      if (i - hd[i - n] >= n) {
        printf("%I64d\n", f[i]);
        break;
      }
    }
  }
  return 0;
}
