#include <bits/stdc++.h>
using namespace std;
const int kMaxN = 1000000;
int n, q, a[kMaxN * 2 + 1];
long long sum[kMaxN * 2 + 1];
int to[kMaxN * 2 + 1];
int solve(long long b) {
  int r = n * 2 + 1;
  for (int i = n * 2; i >= 1; --i) {
    while (sum[r - 1] - sum[i - 1] > b) --r;
    to[i] = r;
  }
  int res = n;
  int rec = 1;
  for (int i = 2; i <= n; ++i)
    if (to[i] - i < to[rec] - rec) {
      rec = i;
    }
  int st = rec;
  for (int i = rec; i <= to[rec]; ++i) {
    int tmp = 0;
    int x = st;
    while (x < st + n) {
      x = to[x];
      ++tmp;
    }
    res = min(res, tmp);
    ++st;
    if (st > n) st -= n;
  }
  return res;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
  }
  for (int i = 1; i <= n * 2; ++i) {
    sum[i] = sum[i - 1] + a[i];
  }
  for (long long b; q--;) {
    scanf("%I64d", &b);
    printf("%d\n", solve(b));
  }
  return 0;
}
