#include <bits/stdc++.h>
using namespace std;
int f[3000005], c[3000005], b[3000005], n, q, x, m, AN;
long long a[3000005], s[3000005];
void go(long long m) {
  int l = 0, r = -1, sum = 0;
  while (l < m && r < m) {
    if (sum >= n) {
      AN = min(AN, r - l + 1);
      sum -= c[l];
      l++;
      continue;
    }
    r++;
    sum += c[r];
  }
}
int main() {
  cin >> n >> q;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) a[i + n] = a[i];
  s[0] = a[0];
  for (int i = 1; i < 2 * n; i++) s[i] = s[i - 1] + a[i];
  while (q--) {
    scanf("%d", &x);
    int j = 0;
    for (int i = 0; i < 2 * n; i++) {
      while (j + 1 < 2 * n && s[j + 1] - ((i == 0) ? 0 : s[i - 1]) <= x) j++;
      b[i] = j - i + 1;
      if (b[i] == 0) b[i] = 1;
    }
    m = 0;
    AN = int(1e9);
    for (int i = 0; i < 2 * n; i++) {
      if (f[i]) {
        continue;
      }
      m = 0;
      j = i;
      while (f[j] == 0 && j < 2 * n) {
        f[j] = 1;
        c[m++] = b[j];
        j += b[j];
      }
      go(m);
    }
    for (int i = 0; i < 2 * n; i++) f[i] = c[i] = b[i] = 0;
    printf("%d\n", AN);
  }
  cin >> n;
}
