#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
const int INF = 1e9;
int n, q, a[N], I_JUST_WANT_TO_WIN_A_MEDAL_IN_IOI[N];
long long int pre[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i + n] = a[i];
  }
  for (int i = 1; i <= n * 2; i++) pre[i] = pre[i - 1] + a[i];
  while (q--) {
    long long int b, sum = 0;
    cin >> b;
    int j = 1, st = 1, ans = INF;
    for (int i = 1; i <= 2 * n; i++) {
      while (j + 1 <= 2 * n && pre[j + 1] - pre[i - 1] <= b) j++;
      I_JUST_WANT_TO_WIN_A_MEDAL_IN_IOI[i] = j + 1;
      if (i <= n && I_JUST_WANT_TO_WIN_A_MEDAL_IN_IOI[st] - st >
                        I_JUST_WANT_TO_WIN_A_MEDAL_IN_IOI[i] - i)
        st = i;
    }
    for (int x = st; x <= min(I_JUST_WANT_TO_WIN_A_MEDAL_IN_IOI[st], n); x++) {
      int cnt = 0, temp = x;
      while (x <= n + temp - 1) {
        cnt++;
        x = I_JUST_WANT_TO_WIN_A_MEDAL_IN_IOI[x];
      }
      x = temp;
      ans = min(ans, cnt);
    }
    cout << ans << "\n";
  }
}
