#include <bits/stdc++.h>
using namespace std;
const int N = 2000010;
int a[N], cnt[N], last[N];
long long s[N];
int main() {
  int n, m;
  long long b;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[n + i] = a[i];
    last[i] = i;
  }
  for (int i = 1; i <= n * 2; i++) {
    s[i] = s[i - 1] + a[i];
  }
  while (m--) {
    scanf("%lld", &b);
    int j = 1;
    for (int i = n + 1; i <= n * 2; i++) {
      while (s[i] - s[j] > b) j++;
      last[i] = last[j];
      cnt[i] = cnt[j] + 1;
      if (i - last[i] >= n) {
        printf("%d\n", cnt[i]);
        break;
      }
    }
  }
  return 0;
}
