#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
long long n, q, num[3 * MAXN], part[3 * MAXN], far[3 * MAXN];
long long comp(int x) {
  int f = x;
  int ct = 0;
  while (f < x + n) {
    f = far[f] + 1;
    ++ct;
  }
  return ct;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    cin >> num[i];
    num[i + n] = num[i];
  }
  part[0] = 0;
  for (int i = 1; i < 2 * n + 5; ++i) part[i] = num[i - 1] + part[i - 1];
  for (int m = 0; m < q; ++m) {
    long long b;
    cin >> b;
    long long ptr = -1, s = 0;
    for (int i = 0; i < n; ++i) {
      while (ptr < i + n - 1 && (s + num[ptr + 1] <= b)) {
        ptr++;
        s += num[ptr];
      }
      far[i] = ptr;
      far[i + n] = ptr + n;
      s -= num[i];
    }
    pair<int, int> mini = {MAXN, -1};
    for (int i = 0; i < n; ++i)
      mini = min(mini, (pair<int, int>)make_pair(far[i] - i + 1, i));
    long long ans = MAXN;
    for (int i = mini.second; i <= far[mini.second] + 10; ++i) {
      ans = min(ans, comp(i % n));
    }
    cout << ans << endl;
  }
}
