#include <bits/stdc++.h>
using namespace std;
long long v[1000005], sum[1000005], dp[1000005];
int pos[1000005];
int main() {
  int n, q, i, j, k, S;
  long long best;
  cin >> n >> q;
  for (i = 1; i <= n; ++i) cin >> v[i], sum[i] = sum[i - 1] + v[i];
  for (int p = 1; p <= q; ++p) {
    cin >> S;
    j = 1;
    for (i = 1; i <= n; ++i) {
      while (j < i && sum[i] - sum[j - 1] > S) ++j;
      dp[i] = dp[j - 1] + 1;
      if (dp[i] == 1)
        pos[i] = i;
      else
        pos[i] = pos[j - 1];
      if (i == n) {
        best = dp[n];
        for (k = j; k <= n; ++k)
          if (sum[pos[k - 1]] + sum[n] - sum[k - 1] <= S)
            best = min(best, dp[k - 1]);
      }
    }
    if (best == 0) best = 1;
    cout << best << '\n';
  }
  return 0;
}
