#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int m;
int n;
int a[2000500];
long long b;
pair<int, int> res[2000500];
int next239[200500];
void build() {
  int p = 0;
  long long s = 0;
  for (int i = 0; i < (n); i++) {
    while (p < i + n && s + a[p] <= b) {
      s += a[p];
      p++;
    }
    next239[i] = p;
    s -= a[i];
  }
}
int getmin() {
  int p = 0;
  int ans = 0;
  while (p < n) {
    ans++;
    p = next239[p];
  }
  return ans;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < (n); i++) {
    scanf("%d", &a[i]);
    a[n + i] = a[i];
  }
  for (int i = 0; i < (m); i++) {
    cin >> b;
    build();
    int k = getmin();
    if (k == 1) {
      cout << 1 << endl;
      continue;
    }
    for (int i = (n)-1; i >= 0; i--) {
      int o = next239[i];
      if (o >= n) {
        res[i] = make_pair(1, o - n);
      } else
        res[i] = make_pair(res[o].first + 1, res[o].second);
      if (res[i].first < k && res[i].second >= i) {
        k--;
        break;
      }
    }
    cout << k << endl;
  }
  return 0;
}
