#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30, maxn = 1000000 + 1000;
int N, Q, pre[maxn << 1], cnt[maxn << 1];
long long b, a[maxn << 1], sum[maxn << 1];
void Init() {
  for (int i = 1; i <= N; ++i) {
    scanf("%I64d", &a[i]);
    a[i + N] = a[i], pre[i] = i;
  }
  for (int i = 1; i <= N * 2; ++i) sum[i] = sum[i - 1] + a[i];
}
void Solve() {
  while (Q--) {
    scanf("%I64d", &b);
    int h = 1;
    for (int t = N + 1; t <= 2 * N; ++t) {
      while (sum[t] - sum[h] > b) h++;
      pre[t] = pre[h], cnt[t] = cnt[h] + 1;
      if (t - pre[t] >= N) {
        printf("%d\n", cnt[t]);
        break;
      }
    }
  }
}
int main() {
  while (scanf("%d%d", &N, &Q) != EOF) {
    Init();
    Solve();
  }
  return 0;
}
