#include <bits/stdc++.h>
using namespace std;
const int MX = 1000005;
int n, q, to[2 * MX];
long long a[2 * MX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[n + i] = a[i];
  }
  while (q--) {
    long long b;
    cin >> b;
    int i = 0, j = 0, mn = n, ind = 0;
    long long acu = 0;
    while (i < n) {
      while (j < 2 * n && acu + a[j] <= b) {
        acu += a[j];
        j++;
      }
      to[i] = j;
      if (j - i < mn) {
        mn = j - i;
        ind = i;
      }
      acu -= a[i];
      i++;
    }
    int res = n;
    for (int j = ind; j <= to[ind]; j++) {
      int k = j, p = 0;
      acu = 0;
      while (acu < n) {
        k %= n;
        acu += to[k] - k;
        k = to[k];
        p++;
      }
      res = min(res, p);
    }
    cout << res << '\n';
  }
  return 0;
}
