#include <bits/stdc++.h>
using namespace std;
const int N = 1000011;
int n, q, a[N], nxt[N];
long long b, S;
int dfs(int v) {
  int x = nxt[v], now = 1;
  while ((v - x + n) % n > (nxt[x] - x + n) % n) {
    now++;
    x = nxt[x];
  }
  now++;
  return now;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    S += a[i];
  }
  while (q--) {
    scanf("%lld", &b);
    if (b >= S) {
      cout << 1 << endl;
      continue;
    }
    int p1 = 0, p2 = 0, ans = 1e9;
    long long mi = 1e18, now = a[0];
    while (p1 < n) {
      while (now <= b) {
        p2++;
        p2 %= n;
        now += a[p2];
      }
      while (p1 < n and now > b) {
        nxt[p1] = p2;
        now -= a[p1];
        p1++;
      }
    }
    int x;
    for (int i = 0; i < n; i++) {
      if ((nxt[i] - i + n) % n < mi) {
        mi = (nxt[i] - i + n) % n;
        x = i;
      }
    }
    for (int y = x; y != (nxt[x]) % n; y = (y + 1) % n) {
      ans = min(ans, dfs(y));
    }
    ans = min(ans, dfs(nxt[x]));
    cout << ans << endl;
  }
}
