#include <bits/stdc++.h>
using namespace std;
int a[5000100];
int nxt[5000100];
int n, q;
bool vis[5000100];
int que[5000100];
inline bool iscross(int l, int mid, int r) {
  if (l < r) {
    return l < mid && mid <= r;
  } else {
    if (l < mid) return true;
    return mid <= r;
  }
}
int getans(long long maxsum) {
  int l = 0, r = 0;
  long long sum = 0;
  while (l < n) {
    while (r < 2 * n && sum <= maxsum) {
      sum += a[r++];
    }
    while (r == 2 * n || sum > maxsum) {
      if (r - l > n) {
        assert(0);
        nxt[l] = l;
      } else {
        nxt[l] = (r - 1) % n;
      }
      sum -= a[l];
      l++;
      if (l == n) break;
    }
  }
  memset(vis, 0, sizeof(vis));
  int hd = 0, tl = 0;
  int res = -1u / 2;
  for (int i = 0; i < n; i++) {
    if (vis[i]) continue;
    hd = tl = 0;
    que[tl++] = i;
    while (true) {
      int nx = nxt[que[tl - 1]];
      while (!vis[nx] && !iscross(que[tl - 1], que[hd], nx)) {
        que[tl++] = nx;
        nx = nxt[que[tl - 1]];
      }
      if (vis[nx]) {
        while (hd < tl) {
          vis[que[hd++]] = true;
        }
        break;
      }
      while (hd < tl && !vis[que[hd]] && iscross(que[tl - 1], que[hd], nx)) {
        vis[que[hd]] = true;
        res = min(res, tl - hd);
        hd++;
      }
      if (hd >= tl || vis[que[hd]]) break;
    }
  }
  return res;
}
int main() {
  while (cin >> n >> q) {
    long long allsum = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      allsum += a[i];
      a[i + n] = a[i];
    }
    for (int i = 0; i < q; i++) {
      long long b;
      cin >> b;
      if (b >= allsum)
        cout << "1" << endl;
      else
        cout << getans(b) << endl;
    }
  }
  return 0;
}
