#include <bits/stdc++.h>
using namespace std;
int N, Q;
long long A[2000002], B;
int getMin() {
  int now = 1, where = 0, size = N;
  for (int i = 1; i <= N; ++i) {
    while (now + 1 < i + N && A[now + 1] - A[i - 1] <= B) ++now;
    if (now - i + 1 < size) {
      where = i;
      size = now - i + 1;
    }
  }
  int result = N;
  for (int i = where; i <= where + size; ++i) {
    int now = i, resnow = 0;
    long long sumnow = 0;
    while (now < i + N) {
      sumnow += A[min(2 * N, now + size - 1)] - A[now - 1];
      now += size;
      while (now < i + N && sumnow + A[now] - A[now - 1] <= B) {
        sumnow += A[now] - A[now - 1];
        ++now;
      }
      sumnow = 0;
      ++resnow;
    }
    result = min(result, resnow);
  }
  return result;
}
int main() {
  cin.sync_with_stdio(false);
  cin >> N >> Q;
  for (int i = 1; i <= N; ++i) cin >> A[i];
  for (int i = N + 1; i <= 2 * N; ++i) A[i] = A[i - N];
  for (int i = 1; i <= 2 * N; ++i) A[i] += A[i - 1];
  for (int i = 1; i <= Q; ++i) {
    cin >> B;
    cout << getMin() << '\n';
  }
}
