#include <bits/stdc++.h>
using namespace std;
long long L[2 * 1000010], last[2 * 1000010], f[2 * 1000010];
long long read() {
  long long s = 0, fh = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + (ch - '0');
    ch = getchar();
  }
  return s * fh;
}
int main() {
  long long N, Q, mx, i, ans, d, j;
  N = read();
  Q = read();
  mx = 0;
  for (i = 1; i <= N; i++) {
    L[i] = read();
    mx = max(mx, L[i]);
    L[N + i] = L[i];
  }
  for (i = 1; i <= 2 * N; i++) L[i] += L[i - 1];
  for (i = 1; i <= N; i++) {
    last[i] = i;
    f[i] = 0;
  }
  while (Q--) {
    d = read();
    j = 1;
    if (d < mx) {
      printf("NIE\n");
      continue;
    }
    ans = 0x7fffffff;
    for (i = N + 1; i <= 2 * N; i++) {
      while (L[i] - L[j] > d) j++;
      last[i] = last[j];
      f[i] = f[j] + 1;
      if (i - last[i] >= N) ans = min(ans, f[i]);
    }
    printf("%lld\n", ans);
  }
  fclose(stdin);
  fclose(stdout);
  return 0;
}
