#include <bits/stdc++.h>
using namespace std;
int a[1000000], f[1000000];
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  int m = 2 * n;
  long long b;
  while (q--) {
    scanf("%I64d", &b);
    int s = 0;
    for (int i = 0, e = 0; i < n; ++i) {
      while (e < m && ((e < n && b >= a[e]) || (e >= n && b >= a[e - n]))) {
        if (e < n)
          b -= a[e];
        else
          b -= a[e - n];
        ++e;
      }
      f[i] = e;
      b += a[i];
      if (e - i < f[s] - s) s = i;
    }
    int ans = n, T = f[s] - s;
    for (int i = 0, j = s; i < T + 1; ++i) {
      int cont = 0, pos = j;
      while (pos - j < n && cont < ans) {
        if (pos < n)
          pos = f[pos];
        else
          pos = f[pos - n] + n;
        ++cont;
      }
      ans = min(ans, cont);
      ++j;
      if (j == n) j = 0;
    }
    printf("%d\n", ans);
  }
  return 0;
}
