#include <bits/stdc++.h>
using namespace std;
int n, q, a[1000000], maxjump[1000000], skip[1000000], skipcost[1000000];
long long b, asum;
pair<int, int> dfs(int start, int cur) {
  if (skip[cur] > cur && (cur < start && start <= skip[cur]))
    return make_pair(cur, 0);
  if (skip[cur] <= cur && (cur < start || start <= skip[cur]))
    return make_pair(cur, 0);
  pair<int, int> ret = dfs(start, skip[cur]);
  ret.second += skipcost[cur];
  skip[cur] = ret.first;
  skipcost[cur] = ret.second;
  return ret;
}
int main() {
  cin.sync_with_stdio(false);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> a[i], asum += a[i];
  for (int Q = 0; Q < q; Q++) {
    cin >> b;
    if (b >= asum) {
      cout << "1\n";
      continue;
    }
    int r = 0;
    long long curcost = 0;
    for (int l = 0; l < n; l++) {
      while (curcost + a[r] <= b) {
        curcost += a[r];
        r = (r + 1) % n;
      }
      maxjump[l] = r;
      skip[l] = r;
      skipcost[l] = 1;
      curcost -= a[l];
    }
    int result = 100000000;
    for (int i = 0; i < n; i++) {
      pair<int, int> ret = dfs(i, i);
      result = min(result, ret.second + skipcost[ret.first]);
      skip[i] = maxjump[i];
      skipcost[i] = 1;
    }
    cout << result << '\n';
  }
  return 0;
}
