#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 20;
int nextt[2 * maxn], ar[2 * maxn], n, q;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    ar[i + n] = ar[i];
  }
  while (q--) {
    long long sum = 0, b;
    cin >> b;
    int i = 0, j = 0, mn = 0, ans = n;
    while (i < 2 * n) {
      while (j < 2 * n && j < i + n && sum + ar[j] <= b) sum += ar[j], j++;
      nextt[i] = j;
      if (i < n && nextt[mn] - mn > nextt[i] - i) mn = i;
      sum -= ar[i];
      i++;
    }
    for (int x = mn; x <= nextt[mn]; x++) {
      int p = 0, o = x;
      while (o < x + n) o = nextt[o], p++;
      ans = min(p, ans);
    }
    cout << ans << endl;
  }
}
