#include <bits/stdc++.h>
using namespace std;
long long n, q;
const int N = 1e6 + 10;
long long v[N];
long long prox[N];
long long get_prox(long long i) {
  long long ans = i + 1;
  if (ans == n) ans = 0;
  return ans;
}
long long get_ant(long long i) {
  long long ans = i - 1;
  if (ans < 0) ans += n;
  return ans;
}
long long get_dist(int j, int i) {
  int ans = j - i;
  if (ans < 0) ans += n;
  return ans;
}
int entre(int i, int l, int r) {
  if (i == l) return 0;
  if (l < r) {
    return i >= l and i <= r;
  }
  return !(i < l and i > r);
}
long long tent(int i) {
  int id_cur = i;
  long long cur_len = 0;
  while (1) {
    cur_len++;
    if (entre(i, id_cur, prox[id_cur])) break;
    id_cur = prox[id_cur];
  }
  return cur_len;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> q;
  long long soma = 0;
  for (int i = 0; i < n; i++) cin >> v[i], soma += v[i];
  for (int qq = 0; qq < q; qq++) {
    long long maxb;
    cin >> maxb;
    if (maxb >= soma) {
      cout << 1 << "\n";
      continue;
    }
    int j = 0;
    long long cur = 0;
    int id_min = -1;
    long long min_len = LLONG_MAX;
    for (int i = 0; i < n; i++) {
      while (cur + v[j] <= maxb) {
        cur += v[j];
        j = get_prox(j);
      }
      prox[i] = j;
      if (get_dist(j, i) < min_len) {
        min_len = get_dist(j, i);
        id_min = i;
      }
      cur -= v[i];
    }
    int ant = id_min;
    while (prox[get_ant(ant)] == prox[id_min]) ant = get_ant(ant);
    long long min_g = LLONG_MAX;
    for (int i = id_min; i != prox[id_min]; i = get_prox(i)) {
      min_g = min(min_g, tent(i));
    }
    min_g = min(min_g, tent(ant));
    cout << min_g << "\n";
  }
}
