#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chkmin(T& a, T const& b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool chkmax(T& a, T const& b) {
  return a < b ? a = b, true : false;
}
const int M = 1000005;
int A[M], last[M << 1], cnt[M << 1];
int n, m;
long long tot;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (0), i_end__ = (n); i < i_end__; ++i)
    scanf("%d", A + i), tot += A[i];
  for (int i = (0), i_end__ = (n); i < i_end__; ++i) cnt[i] = 1, last[i] = i;
  while (m--) {
    long long k, sum = tot;
    scanf("%lld", &k);
    for (int l = 0, r = n; r < n << 1; sum += A[(r++) - n]) {
      while (sum > k) sum -= A[(l++) % n];
      last[r] = last[l];
      cnt[r] = cnt[l] + 1;
      if (r - last[r] >= n) {
        printf("%d\n", cnt[l]);
        break;
      }
    }
  }
  return 0;
}
