#include <bits/stdc++.h>
using namespace std;
int n, m, o, re = 0, tonxt[4000010];
long long res = 0;
long long a[4000010];
bool chk[4000010];
int main() {
  int i, j, k, l;
  long long ll, rr, mid;
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
    a[i] += a[i - 1];
  }
  for (i = n + 1; i <= 2 * n; i++) {
    a[i] = a[n] + a[i - n];
  }
  for (i = 2 * n + 1; i <= 3 * n; i++) {
    a[i] = a[2 * n] + a[i - n * 2];
  }
  for (i = 3 * n + 1; i <= 4 * n; i++) {
    a[i] = a[3 * n] + a[i - n * 3];
  }
  for (i = 0; i < m; i++) {
    scanf("%I64d", &rr);
    if (rr >= a[n]) {
      printf("1\n");
      continue;
    }
    pair<int, int> mn = pair<int, int>(2147483647, -1);
    for (j = 1, k = 1; j <= n * 4; j++) {
      while (k <= n * 4 && a[k] - a[j - 1] <= rr) k++;
      tonxt[j] = k;
      if (j >= n + 1 && j < 2 * n + 1 && tonxt[j] != tonxt[j - 1])
        mn = min(mn, pair<int, int>(k - j, j));
    }
    re = 2147483647;
    for (j = mn.second; j < tonxt[mn.second]; j++) {
      int ss = 0;
      k = j;
      while (k < j + n) {
        k = tonxt[k];
        ss++;
      }
      re = min(re, ss);
    }
    printf("%d\n", re);
  }
  return 0;
}
