#include <bits/stdc++.h>
using namespace std;
int a[2000010], b[1000010], n;
int solve(int s) {
  int cnt = 0, cur = s;
  bool flag = 0;
  while (1) {
    cur = b[cur];
    cnt++;
    if (cur >= s && flag) return cnt;
    if (cur >= n) {
      cur -= n;
      flag = 1;
    }
    if (cur >= s && flag) return cnt;
  }
}
int main() {
  int q;
  scanf("%d%d", &n, &q);
  int i;
  long long sum = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
    a[n + i] = a[i];
  }
  for (i = 0; i < q; i++) {
    long long x, cur = 0;
    int r = 0, j;
    scanf("%lld", &x);
    if (x >= sum) {
      printf("1\n");
      continue;
    }
    for (j = 0; j < n; j++) {
      while (cur + a[r] <= x) cur += a[r++];
      b[j] = r;
      cur -= a[j];
    }
    int min_ = 998244353, pos, ans = 998244353;
    for (j = 0; j < n; j++) {
      if (b[j] - j < min_) {
        min_ = b[j] - j;
        pos = j;
      }
    }
    for (j = pos; j <= b[pos]; j++) {
      ans = min(ans, solve(j % n));
    }
    printf("%d\n", ans);
  }
  return 0;
}
