#include <bits/stdc++.h>
const int N = 1e6 + 7;
using namespace std;
int n, q, pre[N << 1], cnt[N << 1];
long long ai[N << 1], sum[N << 1];
void Init() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%I64d", &ai[i]), ai[i + n] = ai[i];
  for (int i = 1; i <= n * 2; ++i) sum[i] = sum[i - 1] + ai[i];
}
void Solve() {
  long long bi;
  scanf("%I64d", &bi);
  for (int i = 1; i <= n * 2; ++i) pre[i] = i, cnt[i] = 0;
  ;
  int j = 0;
  int ans = n + 1;
  for (int i = n + 1; i <= n * 2; ++i) {
    while (sum[i] - sum[j] > bi) ++j;
    cnt[i] = cnt[j] + 1;
    pre[i] = pre[j];
    if (i - pre[i] >= n) ans = min(ans, cnt[i]);
  }
  printf("%d\n", ans);
}
int main() {
  Init();
  while (q--) {
    Solve();
  }
  return 0;
}
