#include <bits/stdc++.h>
using namespace std;
int n, q;
int a[2000010 * 2];
long long s[2000010 * 2];
long long b[60];
int f[2000010 * 2];
int g[2000010 * 2];
int ans;
int find_in_sum(int x, long long p) {
  int l = 0, r = x;
  int pos = x + 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (s[mid] >= p) {
      r = mid - 1;
      pos = mid;
    } else {
      l = mid + 1;
    }
  }
  return pos;
}
int main() {
  int i, j;
  scanf("%d%d", &n, &q);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s[i] = s[i - 1] + a[i];
  }
  for (i = n + 1; i <= 2 * n; i++) {
    a[i] = a[i - n];
    s[i] = s[i - 1] + a[i];
  }
  for (i = 1; i <= q; i++) scanf("%lld", &b[i]);
  for (int bb = 1; bb <= q; bb++) {
    long long maxh = b[bb];
    memset(f, 0, sizeof(f));
    ans = 1e9;
    long long last = 0;
    int last_begin = 0;
    for (i = 1; i <= 2 * n; i++) {
      last += a[i];
      if (last > maxh) {
        while (last > maxh) {
          last -= a[last_begin];
          last_begin++;
        }
      }
      int d = max(0, last_begin - 1);
      f[i] = f[d] + 1;
      if (g[d] == 0)
        g[i] = d;
      else
        g[i] = g[d];
      if (i >= n) {
        int flag = 0;
        if (g[i] != (i - n)) {
          flag = 1;
        }
        ans = min(ans, f[i] - f[i - n] + flag);
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
