#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 100;
int N, Q;
int A[MAXN];
long long P[MAXN];
long long B;
int main() {
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
  }
  scanf("%d %d", &N, &Q);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    A[i + N] = A[i];
  }
  for (int i = 0; i < 2 * N; i++) {
    P[i + 1] = P[i] + A[i];
  }
  while (Q--) {
    scanf("%I64d", &B);
    if (B >= P[N]) {
      puts("1");
      continue;
    }
    int mn = N, ind = 0;
    long long cs = 0;
    for (int i = 0, j = 0; i < N;) {
      if (cs <= B) {
        cs += A[j];
        j++;
      } else {
        if (mn > j - i) {
          mn = j - i;
          ind = i;
        }
        cs -= A[i];
        i++;
      }
    }
    int ans = N;
    for (int i = ind; P[i] - P[ind] <= B; i++) {
      int use = 0, cur = i;
      while (cur < i + N) {
        int lo = cur, dist = 1;
        while (lo + dist < i + N && P[lo + dist] - P[lo] <= B) {
          dist *= 2;
        }
        int hi = min(lo + dist, i + N) + 1;
        while (hi - lo > 1) {
          int mid = (lo + hi) / 2;
          if (P[mid] - P[cur] <= B) {
            lo = mid;
          } else {
            hi = mid;
          }
        }
        cur = lo;
        use++;
      }
      if (ans > use) {
        ans = use;
      }
    }
    printf("%d\n", ans);
  }
}
