#include <bits/stdc++.h>
using namespace std;
int n, query;
int a[1000000];
int to[1000000];
int solve(long long q) {
  int rg = 0;
  long long curr = 0;
  int ans = 1 << 29;
  for (int i = 0; i < n; i++) {
    while (curr + a[rg] <= q) {
      curr += a[rg];
      rg++;
      if (rg == n) rg = 0;
    }
    to[i] = rg;
    curr -= a[i];
  }
  int minLen = 1 << 29;
  int minId = -1;
  for (int i = 0; i < n; i++) {
    int currDist;
    if (to[i] > i)
      currDist = to[i] - i;
    else
      currDist = n - i + to[i];
    if (currDist < minLen) {
      minLen = currDist;
      minId = i;
    }
  }
  for (int i = minId; i <= minId + minLen; i++) {
    int currans = 0;
    int currI = i % n;
    while (currI < to[currI]) {
      currans++;
      currI = to[currI];
    }
    currI = to[currI];
    currans++;
    while (currI < (i % n)) {
      currans++;
      currI = to[currI];
    }
    ans = min(ans, currans);
  }
  return ans;
}
int main() {
  scanf("%d%d", &n, &query);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    sum += a[i];
  }
  for (int i = 0; i < query; i++) {
    long long x;
    scanf("%I64d", &x);
    if (x < sum)
      printf("%d\n", solve(x));
    else
      printf("1\n");
  }
  return 0;
}
