#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e6 + 5;
long long a[N], len[N];
long long sum[N];
long long get(int i, int j) {
  long long res = sum[j];
  if (i) res -= sum[i - 1];
  return res;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    a[n + i] = a[i];
  }
  sum[0] = a[0];
  for (int i = 1; i < 2 * n; ++i) {
    sum[i] = a[i] + sum[i - 1];
  }
  while (q--) {
    long long b, val = 0, j = 0, mi = 1e9, index;
    cin >> b;
    for (int i = 0; i < n; ++i) {
      if (i) val -= a[i - 1];
      while (val + a[j % n] <= b && j < i + n) {
        val += a[j % n];
        ++j;
      }
      len[i] = j - i;
      if (mi > j - i) {
        mi = j - i;
        index = i;
      }
    }
    long long res = 1e9;
    for (int i = 0; i < mi; ++i) {
      long long tmp = 0, last;
      j = index + i;
      while (j < index + i + n) {
        last = j;
        j = j + len[j % n];
        ++tmp;
      }
      int start = index + i;
      if (start + len[start % n] - 1 < last &&
          get(start, start + len[start % n] - 1) +
                  get(last, index + i + n - 1) <=
              b)
        --tmp;
      res = min(res, tmp);
    }
    cout << res << endl;
  }
  return 0;
}
