#include <bits/stdc++.h>
using namespace std;
int ar[2000005], n, m, q, j, mn, mx, say, y, go[2000005];
int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
    ar[i + n] = ar[i];
  }
  while (q--) {
    cin >> m;
    int top = 0;
    int mn = 1;
    int mx;
    j = 1;
    for (int i = 1; i <= n + n; i++) {
      while (j <= n + n && top + ar[j] <= m) {
        top += ar[j++];
      }
      go[i] = j;
      if (i <= n && j - i < go[mn] - mn) mn = i;
      top -= ar[i];
    }
    mx = min(n, go[mn]);
    int ans = 2000005;
    for (int i = mn; i <= mx; i++) {
      int y = i;
      int say = 0;
      while (y < i + n) {
        y = go[y];
        say++;
      }
      ans = min(say, ans);
    }
    cout << ans << endl;
  }
}
