#include <bits/stdc++.h>
using namespace std;
long long pos, n, q, dap, a[1000010], b[1000010];
struct data {
  long long val, p;
} d[1000010];
int main() {
  long long i, x, j;
  scanf("%lld %lld", &n, &q);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    b[i] = b[i - 1] + a[i];
  }
  for (i = 1; i <= q; i++) {
    scanf("%lld", &x);
    dap = 1e18;
    memset(d, 0, sizeof d);
    for (j = 1; j <= n; j++) {
      if (b[j] > x) {
        pos = lower_bound(b + 1, b + n + 1, b[j] - x) - b;
        d[j].val = d[pos].val + 1;
        d[j].p = d[pos].p;
      } else {
        pos = lower_bound(b + 1, b + n + 1, b[n] - (x - b[j])) - b;
        d[j].val = 1;
        d[j].p = pos;
      }
      if (j >= d[j].p) dap = min(dap, d[j].val);
    }
    printf("%lld\n", dap);
  }
  return 0;
}
