#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
int n, a[N], q, cnt[N], nxt[N];
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++)
    scanf("%d", &a[i]), a[i + n] = a[i], nxt[i + n] = i + n;
  nxt[2 * n + 1] = 2 * n + 1;
  while (q--) {
    long long k;
    scanf("%I64d", &k);
    long long sum = 0;
    int ptr = 0;
    for (int i = 1; i <= n; i++) {
      if (ptr < i)
        ptr = i, sum = 0;
      else
        sum -= a[i - 1];
      while (ptr <= n * 2 && sum + a[ptr] <= k) sum += a[ptr++];
      nxt[i] = ptr;
    }
    for (int i = n; i; i--) cnt[i] = cnt[nxt[i]] + 1, nxt[i] = nxt[nxt[i]];
    int ans = n;
    for (int i = 1; i <= n; i++)
      if (nxt[i] - i >= n) ans = min(ans, cnt[i]);
    printf("%d\n", ans);
  }
  return 0;
}
