#include <bits/stdc++.h>
const int MOD = 1000000007;
using namespace std;
int N, queries;
long long arr[1000010];
int jmp[2000010];
int ijmp[2000010];
int* fjmp[2000010];
int place[2000010];
int taken[2000010];
bool seen[1000010];
long long B;
int main() {
  scanf("%d", &(N));
  scanf("%d", &(queries));
  for (int i = (0); i < (N); i++) scanf("%lld", &(arr[i]));
  for (int k = (0); k < (queries); k++) {
    scanf("%lld", &(B));
    memset(seen, 0, sizeof seen);
    int ans = N;
    {
      queue<long long> Q;
      for (int i = N - 2; i >= 0; i--) Q.push(arr[i]);
      long long csum = 0;
      for (int i = (0); i < (N - 1); i++) csum += arr[i];
      for (int i = N - 1; i >= 0; i--) {
        csum += arr[i];
        Q.push(arr[i]);
        while (csum > B) {
          csum -= Q.front();
          Q.pop();
        }
        jmp[i] = i + Q.size();
        jmp[i + N] = i + N + Q.size();
      }
      for (int i = 2 * N - 1; i >= 0; i--)
        if (jmp[i] < N * 2) ijmp[jmp[i]] = i;
    }
    for (int i = (0); i < (N * 2); i++) fjmp[i] = place + i;
    for (int i = N * 2 - 1; i >= 0; i--) {
      int o = jmp[i];
      if (o >= N * 2 || o >= i + N) {
        fjmp[i][0] = i;
        taken[i] = 0;
      } else {
        taken[i] = taken[o] + 1;
        int* x = fjmp[o];
        while (x[0] >= i + N) {
          x[0] = ijmp[x[0]];
          taken[i]--;
        }
        fjmp[i] = x;
      }
      if (i < N) ans = min(ans, taken[i] + 1);
    }
    printf("%d\n", ans);
  }
}
