#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0LL) return a;
  return gcd(b, a % b);
}
int main(void) {
  int n, q;
  scanf("%d%d", &n, &q);
  vector<long long> a(n, 0LL);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  while (q--) {
    long long b;
    scanf("%lld", &b);
    vector<bool> init(n, false);
    vector<int> nearest(n, 0);
    long long sum = 0LL;
    for (int i = 0; i < n; i++) sum += a[i];
    if (sum <= b) {
      printf("1\n");
      continue;
    }
    int it = 0;
    sum = 0LL;
    for (int i = 0; i < n; i++) {
      while (sum <= b) {
        sum += a[it % n];
        it++;
      }
      nearest[i] = (it - i - 1);
      sum -= a[i];
    }
    vector<int> ans(n, -1);
    int answer = INT_MAX;
    for (int i = 0; i < n; i++) {
      if (init[i]) {
        answer = min(answer, ans[i]);
        continue;
      }
      int last = 0;
      int next = i;
      int counter = 0;
      while (next < i + n) {
        if (init[next % n]) {
          counter = ans[next % n];
          break;
        }
        last = next;
        next += nearest[next % n];
        counter++;
      }
      ans[i] = counter;
      init[i] = true;
      last = last + nearest[last];
      next = i + nearest[i];
      bool flag = true;
      while (next < i + n) {
        if (init[next % n]) {
          break;
        }
        if (flag && last % n == next % n) {
          counter--;
          flag = false;
        }
        ans[next % n] = counter;
        init[next % n] = true;
        last += nearest[last % n];
        next += nearest[next % n];
      }
    }
    for (int i = 0; i < n; i++) answer = min(answer, ans[i]);
    printf("%d\n", answer);
  }
  return 0;
}
