#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-11;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long loo = 1ll << 62;
const int mods = 998244353;
const int MAXN = 3e6 + 50;
const int INF = 0x3f3f3f3f;
inline long long read() {
  long long f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
int nxt[MAXN];
long long a[MAXN];
int main() {
  int n = read(), Case = read(), N = n << 1;
  for (int i = 1; i <= n; i++) a[i] = a[i + n] = read();
  while (Case--) {
    int mn = 1, ans = INF;
    long long sum = 0, B = read();
    for (int i = 1, r = 0; i <= N; i++) {
      while (r < N && sum + a[r + 1] <= B) r++, sum += a[r];
      nxt[i] = r + 1;
      if (i <= n && nxt[i] - i < nxt[mn] - mn) mn = i;
      sum -= a[i];
    }
    for (int i = mn; i <= nxt[mn]; i++) {
      int l = (i > n ? i - n : i), r = l, num = 0;
      while (r < l + n) num++, r = nxt[r];
      upmin(ans, num);
    }
    printf("%d\n", ans);
  }
  return 0;
}
