#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 10;
int n, q, Next[2 * N], a[2 * N];
long long b;
int minlen, idmin;
void input() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i + n] = a[i];
  }
}
void cal_Next() {
  minlen = n + 1;
  int j = 0;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    while (j + 1 - i + 1 <= n and sum + a[j + 1] <= b) {
      sum += a[j + 1];
      j++;
    };
    if (j - i + 1 < minlen) {
      minlen = j - i + 1;
      idmin = i;
    }
    Next[i] = j;
    sum -= a[i];
  }
  for (int i = n + 1; i <= 2 * n; i++) Next[i] = Next[i - n] + n;
}
void answer() {
  int res = 1e9;
  for (int i = idmin; i <= idmin + minlen; i++) {
    int cur, cnt = 0, oldi = i;
    if (oldi > n) oldi -= n;
    cur = oldi;
    while (1) {
      cnt++;
      cur = Next[cur] + 1;
      if (cur - oldi + 1 > n) break;
    }
    res = min(res, cnt);
  }
  cout << res << '\n';
}
void solve() {
  cin >> b;
  cal_Next();
  answer();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  input();
  for (int i = 1; i <= q; i++) solve();
  return 0;
}
