#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
int n, a[N + N + 600];
long long sum[N + N + 600];
int nastpuniii[N + N + 600];
int q;
long long m;
int f(int x) {
  int s = x;
  int res = 0;
  int p;
  int kek = sum[nastpuniii[x] - 1] - sum[x - 1];
  while (x - s + 1 <= n) {
    res++;
    p = sum[min(s + n - 1, nastpuniii[x])] - sum[x - 1];
    x = nastpuniii[x];
  }
  if (kek + p <= m) res--;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[n + i] = a[i];
  }
  for (int i = 1; i <= n + n; ++i) sum[i] = sum[i - 1] + a[i];
  for (int t1 = 1; t1 <= q; t1++) {
    cin >> m;
    int j = 1;
    int ans = 1000000009;
    int start = 1;
    int MARKUSHA = 1000000009;
    for (int i = 1; i <= n + n; ++i) {
      while (sum[j] - sum[i - 1] <= m && j <= n + n) ++j;
      nastpuniii[i] = min(j, i + n - 1);
      if (i <= n && nastpuniii[i] - i < MARKUSHA) {
        start = i;
        MARKUSHA = nastpuniii[i] - i;
      }
    }
    for (int i = start; i <= nastpuniii[start] - 1; ++i) {
      ans = min(ans, f(i));
    }
    cout << ans << "\n";
  }
}
