#include <bits/stdc++.h>
int min(int a, int b) { return a < b ? a : b; }
int aa[1000000], n;
int kk[1000000];
long long bb[1000000], qq[1000000];
int solve(long long b) {
  int i, j, k_;
  long long a;
  a = 0;
  k_ = n;
  for (i = 0, j = 0; j < n; j++) {
    long long q;
    a += aa[j];
    while (a > b) a -= aa[i++];
    if (i == 0)
      kk[j] = 1, bb[j] = a;
    else
      kk[j] = kk[i - 1] + 1, bb[j] = bb[i - 1];
    q = j + 1 < n ? qq[j + 1] : 0;
    if (q <= b) k_ = min(k_, kk[j] + (bb[j] + q <= b ? 0 : 1));
  }
  return k_;
}
int main() {
  int q, i;
  long long a;
  scanf("%d%d", &n, &q);
  for (i = 0; i < n; i++) scanf("%d", &aa[i]);
  a = 0;
  for (i = n - 1; i >= 0; i--) qq[i] = a += aa[i];
  while (q--) {
    long long b;
    scanf("%lld", &b);
    printf("%d\n", solve(b));
  }
  return 0;
}
