#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000010;
int h[MAXN], ls[MAXN], a[MAXN];
int solve(int n, long long b) {
  int ptr = n - 1;
  long long sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    sum += a[i];
    while (sum > b) {
      sum -= a[ptr];
      ptr--;
    }
    if (ptr + 1 == n) {
      h[i] = 1;
      ls[i] = i;
    } else {
      h[i] = h[ptr + 1] + 1;
      ls[i] = ls[ptr + 1];
    }
  }
  if (h[0] == 1) return 1;
  int ans = h[0];
  for (int i = n - 1; i >= 0; i--) {
    sum += a[i];
    while (ptr >= 0 && sum > b) {
      sum -= a[ptr];
      ptr--;
    }
    if (ptr < 0) break;
    int rans = h[ptr + 1] + 1;
    if (ls[ptr + 1] >= i) rans--;
    ans = min(ans, rans);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int tt = 0; tt < q; tt++) {
    long long b;
    cin >> b;
    cout << solve(n, b) << "\n";
  }
}
