#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
long long read() {
  long long s = 0;
  char c = getchar(), lc = '+';
  while (c < '0' || '9' < c) lc = c, c = getchar();
  while ('0' <= c && c <= '9') s = s * 10 + c - '0', c = getchar();
  return lc == '-' ? -s : s;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x < 10)
    putchar(x + '0');
  else
    write(x / 10), putchar(x % 10 + '0');
}
void print(long long x = -1, char c = '\n') {
  write(x);
  putchar(c);
}
long long a[N], lsum[N], rsum[N];
pair<long long, long long> l[N], r[N];
signed main(signed Goodbye, char *Wangang[]) {
  (void)Goodbye, (void)Wangang;
  long long n = read(), q = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= n; i++) lsum[i] = lsum[i - 1] + a[i];
  for (long long i = n; i >= 1; i--) rsum[i] = rsum[i + 1] + a[i];
  while (q--) {
    long long k = read(), ans = n;
    for (long long i = 1, j = 1, sum = a[1]; i <= n; sum += a[++i]) {
      while (sum > k) sum -= a[j++];
      if (j == 1)
        l[i] = make_pair(i, 0);
      else
        l[i] = make_pair(l[j - 1].first, l[j - 1].second + 1);
    }
    for (long long i = n, j = n, sum = a[n]; i >= 1; sum += a[--i]) {
      while (sum > k) sum -= a[j--];
      if (j == n)
        r[i] = make_pair(i, 0);
      else
        r[i] = make_pair(r[j + 1].first, r[j + 1].second + 1);
    }
    for (long long i = 0; i < n; i++)
      ans = min(ans, l[i].second + r[i + 1].second + 1 +
                         (lsum[l[i].first] + rsum[r[i + 1].first] > k));
    print(ans);
  }
  return 0;
}
