#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 2e6 + 10;
int a[SIZE];
int num[SIZE], nxt[SIZE];
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  long long sum = 0;
  for (int i = 0; i < (n); ++i) {
    scanf("%d", &(a[i]));
    sum += a[i];
    a[i + n] = a[i];
  }
  for (int tt = 1; tt <= q; tt++) {
    long long b;
    scanf("%I64d", &b);
    if (b >= sum) {
      puts("1");
      continue;
    }
    {
      int rr = -1;
      long long now = 0;
      for (int i = 0; i < (n); ++i) {
        while (now + a[rr + 1] <= b) now += a[++rr];
        nxt[i] = rr + 1;
        nxt[i + n] = rr + 1 + n;
        num[i] = 1;
        now -= a[i];
      }
    }
    int an = n;
    for (int i = n - 1; i >= 0; i--) {
      if (nxt[i] < n) {
        num[i] += num[nxt[i]];
        nxt[i] = nxt[nxt[i]];
      }
      if (nxt[i] >= i + n) an = min(an, num[i]);
    }
    printf("%d\n", an);
  }
  return 0;
}
