#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
int n, q;
int a[MAXN];
int dad[MAXN];
int len[MAXN];
int main(void) {
  scanf("%d%d", &n, &q);
  for (int i = (0); i < (n); ++i) scanf("%d", a + i);
  for (int qq = (0); qq < (q); ++qq) {
    long long b;
    scanf("%lld", &b);
    long long sum = 0;
    int cdad = 0;
    int clen = 0;
    int best = 0;
    for (int it = (0); it < (2); ++it) {
      for (int i = (0); i < (n); ++i) {
        sum += a[i];
        clen += 1;
        while (sum - a[cdad] > b || clen > n + 1) {
          sum -= a[cdad];
          cdad = (cdad + 1) % n;
          clen -= 1;
        }
        dad[i] = cdad;
        len[i] = clen;
        if (len[i] < len[best]) best = i;
      }
    }
    int sol = n;
    for (int i = (0); i < (len[best]); ++i) {
      int p = (dad[best] + i) % n;
      int passed = 0;
      int csol = 0;
      while (passed < n) {
        passed += len[p] - 1;
        p = dad[p];
        ++csol;
      }
      sol = min(sol, csol);
    }
    printf("%d\n", sol);
  }
  return 0;
}
