#include <bits/stdc++.h>
using namespace std;
long long s[2000050];
long long a[2000050];
int from[2000050];
int ans[2000050];
int n, m, k;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
  }
  s[0] = 0;
  for (int i = 1; i <= 2 * n; i++) {
    s[i] = s[i - 1] + a[i];
  }
  for (int t = 1; t <= m; t++) {
    for (int i = 1; i <= 2 * n; i++) {
      from[i] = i;
      ans[i] = 0;
    }
    int now = 1;
    scanf("%d", &k);
    for (int i = n + 1; i <= 2 * n; i++) {
      while (s[i] - s[now] > k) {
        now++;
      }
      from[i] = from[now];
      ans[i] = ans[now] + 1;
      if (i - from[i] >= n) {
        printf("%d\n", ans[i]);
        break;
      }
    }
  }
  return 0;
}
