#include <bits/stdc++.h>
using namespace std;
const int maxn = 2111111;
unordered_map<int, int> mp;
vector<int> edge[maxn];
int f[maxn];
int dis[maxn];
int a[maxn];
int find(int x, int start, int n) {
  if (start - x >= n) {
    return x;
  }
  if (!x) {
    return x;
  }
  f[x] = find(f[x], start, n);
  return f[x];
}
int run(int n, long long b) {
  int ans = maxn;
  long long sum = 0;
  for (int i = 1, j = 1; i <= n * 2; ++i) {
    sum += a[i];
    while (sum > b) {
      sum -= a[j++];
    }
    f[i] = j - 1;
    dis[i] = dis[j - 1] + 1;
  }
  for (int i = n * 2; i >= n; --i) {
    int j = find(i, i, n);
    ans = min(ans, dis[i] - dis[j]);
  }
  return ans;
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    a[n + i] = a[i];
  }
  long long b;
  for (int i = 0; i < q; ++i) {
    cin >> b;
    cout << run(n, b) << endl;
  }
  return 0;
}
