#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 1;
int n, q, f[MAX];
long long a[MAX], b;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  while (q--) {
    cin >> b;
    if (a[n] <= b) {
      cout << 1 << endl;
      continue;
    }
    int j = 0;
    while (a[++j] <= b)
      ;
    --j;
    long long tmp;
    for (int i = n; i >= 1; --i) {
      do {
        tmp = (j < i ? a[j] + a[n] - a[i - 1] : a[j] - a[i - 1]);
        if (tmp <= b)
          break;
        else if (j == 1)
          j = n;
        else
          --j;
      } while (1);
      f[i] = j;
    }
    tmp = 0;
    int pos = 1, res = 1;
    pair<int, int> seg;
    for (int i = 1; i <= n; ++i)
      if (a[i] - a[pos - 1] > b) {
        if (!seg.first || seg.second - seg.first > i - pos)
          seg = pair<int, int>(pos, i);
        pos = i;
        ++res;
      }
    int cnt = 0;
    for (int i = seg.first + 1; i <= seg.second; ++i) {
      j = i;
      cnt = 1;
      bool check = false;
      do {
        if (j > f[j] || f[j] == n) check = true;
        j = f[j] + 1;
        if (j == n + 1) j = 1;
        if (check && j >= i) break;
        ++cnt;
      } while (1);
      if (cnt < res) res = cnt;
    }
    cout << res << endl;
  }
  return 0;
}
