#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> b(q);
  for (auto& bb : b) {
    cin >> bb;
  }
  vector<long long> cumSum(2 * n);
  cumSum[0] = a[0];
  for (int i = 1; i < 2 * n; i++) {
    cumSum[i] = cumSum[i - 1] + a[i % n];
  }
  vector<int> last(n);
  vector<int> len(n);
  for (const auto query : b) {
    int ans = n;
    int right = 2 * n - 1;
    for (int i = n - 1; i > -1; i--) {
      while (cumSum[right] - cumSum[i] > query) {
        right--;
      }
      if (right >= n) {
        len[i] = 1;
        last[i] = right;
      } else {
        len[i] = len[right] + 1;
        last[i] = last[right];
      }
      if (last[i] >= i + n) {
        ans = min(ans, len[i]);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
