#include <bits/stdc++.h>
const int maxn = 2000010;
long long val[maxn], n, sum, veryleft[maxn], cnt[maxn];
std::deque<long long> q;
long long query(int k) {
  if (sum <= k) return 1;
  long long inseq = sum, ans = maxn;
  for (int i = 1; i <= n; i++) q.push_back(val[i + 1]);
  for (int i = n + 1; i <= (n << 1); i++) {
    while (inseq > k) {
      inseq -= q.front();
      q.pop_front();
    }
    int s = i - q.size(), t = veryleft[s];
    if (t)
      veryleft[i] = t;
    else
      veryleft[i] = s;
    cnt[i] = cnt[s] + 1;
    if (i - veryleft[i] >= n) ans = std::min(ans, cnt[i]);
    if (i != (n << 1)) {
      q.push_back(val[i + 1]);
      inseq += val[i + 1];
    }
  }
  while (!q.empty()) q.pop_back();
  return ans;
}
int main() {
  long long m;
  scanf("%I64d%I64d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &val[i]);
    val[n + i] = val[i];
    sum += val[i];
  }
  for (int i = 0; i < m; i++) {
    long long k;
    scanf("%I64d", &k);
    printf("%I64d\n", query(k));
  }
  return 0;
}
