#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int n, a[N * 2], b[N * 2];
pair<int, int> r[N];
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[n + i] = a[i];
  }
  while (q--) {
    long long sum;
    scanf("%lld", &sum);
    int ans = 1e9, high = -1;
    long long w = 0;
    for (int i = 0; i < n; i++) {
      for (; high + 1 < n * 2 && w + a[high + 1] <= sum;) {
        w += a[++high];
      }
      w -= a[i];
      b[i] = high + 1;
    }
    for (int i = n - 1; i >= 0; i--) {
      if (b[i] >= n) {
        r[i] = {b[i], 1};
      } else {
        r[i] = {r[b[i]].first, r[b[i]].second + 1};
      }
      if (r[i].first - n >= i) {
        ans = min(ans, r[i].second);
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
