#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, q, a[N], l[N], nxt[N], ans;
long long m, sum[N];
inline void calc(int st) {
  int len = 0, res = 0;
  for (int i = st; len<n; i = nxt[i] + 1, i = i> n ? i - n : i)
    len += l[i] + 1, ++res;
  ans = min(ans, res);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), sum[i] = sum[i - 1] + a[i];
  while (q--) {
    cin >> m;
    if (sum[n] <= m) {
      puts("1");
      continue;
    }
    ans = n;
    int min1 = n + 1, num, ne = 1;
    long long cur = 0;
    for (int i = 1; i <= n; i++) {
      cur -= a[i - 1];
      ne = ne > n ? ne - n : ne;
      while (cur + a[ne] <= m) cur += a[ne++], ne = ne > n ? ne - n : ne;
      nxt[i] = ne > 1 ? ne - 1 : n;
      l[i] = nxt[i] < i ? nxt[i] - i + n : nxt[i] - i;
      if (l[i] < min1) min1 = l[i], num = i;
    }
    for (int i = 1; i <= n; i++)
      if ((nxt[i] + 1) % n + 1 == i) {
        ans = 2;
        break;
      }
    for (int i = num; i != (nxt[num] + 1) % n + 1; i = i == n ? 1 : i + 1)
      calc(i);
    printf("%d\n", ans);
  }
}
