#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 1000 + 10;
long long a[MAXN];
int cnt, last, n, first;
void calc(int ind, long long b, int val) {
  long long sum = 0;
  cnt = 1;
  last = ind;
  first = -1;
  for (int j = 0; j < n; j++) {
    int i = (val * j + ind + n) % n;
    if (sum + a[i] <= b)
      sum += a[i];
    else {
      if (first == -1) first = (i - 1 + n) % n;
      sum = a[i];
      cnt++;
      last = i;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < q; i++) {
    long long b;
    int ans = 1e9;
    cin >> b;
    calc(0, b, 1);
    ans = min(ans, cnt);
    int id = last;
    calc(id, b, 1);
    ans = min(ans, cnt);
    calc((id - 1 + n) % n, b, -1);
    ans = min(ans, cnt);
    if (first != -1) {
      calc(first, b, -1);
      ans = min(ans, cnt);
    }
    cout << ans << '\n';
  }
  return 0;
}
