#include <bits/stdc++.h>
using namespace std;
void deba(int* a, int n) {
  cerr << "| ";
  for (int i = 0; i < (n); i++) cerr << a[i] << " ";
  cerr << "|" << endl;
}
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
const int INF = 1 << 30;
int a[2234567];
int e[1234567];
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  ;
  long long suma = 0;
  for (int i = 0; i < (n); i++) {
    scanf("%d", &a[i]);
    ;
    suma += a[n + i] = a[i];
  }
  for (int i = 0; i < (q); i++) {
    long long K;
    cin >> K;
    if (suma <= K) {
      cout << 1 << endl;
      continue;
    }
    int l = 0;
    int r = 0;
    long long sum = a[0];
    int sh = 0, mm = INF;
    while (l < n + 1) {
      while (sum + a[r + 1] <= K && r < 2 * n - 1) {
        sum += a[++r];
      }
      e[l] = r;
      if (e[l] - l < mm && l != 0) {
        sh = l;
        mm = e[l] - l;
      }
      while (sum + a[r + 1] > K && l < n + 1) {
        sum -= a[l++];
        e[l] = r;
      }
    }
    e[0] = e[n] % n;
    int mn = n;
    for (int i = (sh); i <= (e[sh]); i++) {
      int p = i % n;
      int cnt = 0;
      long long sm = 0;
      while (sm < n) {
        sm += e[p] - p + 1;
        p = (e[p] + 1) % n;
        cnt++;
      }
      mn = min(mn, cnt);
    }
    cout << mn << endl;
  }
  return 0;
}
