#include <bits/stdc++.h>
const long long inf = 1000000000ll;
const long long inf64 = inf * inf;
const long long base = inf + 7;
const long long MOD = inf + 9;
const double pi = acos(-1.0);
using namespace std;
bool solve() {
  int n, q;
  scanf("%d %d", &n, &q);
  vector<long long> a(2 * n + 1);
  for (int i(1); i <= n; i++) scanf("%I64d", &a[i]), a[i + n] = a[i];
  vector<int> from(2 * n + 1), dp(2 * n + 1), last(2 * n + 1), used(2 * n + 1);
  vector<long long> sum(2 * n + 1, 0);
  for (int i(1); i <= 2 * n; i++) sum[i] = sum[i - 1] + a[i];
  for (int i(0); i < q; i++) {
    long long b;
    scanf("%I64d", &b);
    int j = -1;
    for (int z(1); z <= n; z++) {
      from[z] = dp[z] = used[z] = last[z] = 0;
      if (sum[z] > b) {
        if (j == -1) j = 1;
        while (sum[z] - sum[j - 1] > b) j++;
        from[z] = j - 1;
      }
      dp[z] = dp[from[z]] + 1;
      if (from[z]) {
        last[z] = last[from[z]];
      } else
        last[z] = z;
    }
    int ans = n + 1;
    long long S = 0;
    for (int z(n); z >= 1; z--) {
      if (S > b) break;
      int tmp = dp[z];
      if (sum[last[z]] + S > b) tmp++;
      ans = min(ans, tmp);
      S += a[z];
    }
    printf("%d\n", ans);
  }
  return true;
}
int main() {
  solve();
  return 0;
}
