#include <bits/stdc++.h>
using namespace std;
int n, q;
const int mn = 1e6 + 10;
long long as[mn];
long long b;
long long sum[mn];
int le[mn];
void solve(long long val) {
  int j = 1;
  long long tmp = as[0];
  int mini = 2e6;
  int where = -1;
  for (int i = 0; i < n; i++) {
    while (as[j % n] + tmp <= val) {
      tmp += as[j % n];
      j++;
    }
    if (mini > j - i) {
      mini = j - i;
      where = i;
    }
    le[i] = j - i;
    tmp -= as[i];
  }
  int best = mn + 10;
  for (int i = 0; i < mini + 1; i++) {
    int beg = where + i;
    beg %= n;
    int acum = 0;
    int c = 0;
    while (acum < n) {
      acum += le[beg];
      beg += le[beg];
      beg %= n;
      c++;
    }
    best = min(c, best);
  }
  printf("%d\n", best);
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%lld", as + i);
  }
  sum[0] = as[0];
  long long s;
  for (int i = 0; i < n; i++) {
    if (i) sum[i] = sum[i - 1] + as[i];
  }
  s = sum[n - 1];
  for (int i = 0; i < q; i++) {
    scanf("%lld", &b);
    if (s <= b)
      printf("1\n");
    else
      solve(b);
  }
  return 0;
}
