#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  vector<int> a(n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    a[i] = x;
    sum += a[i];
  }
  vector<int> last(n);
  vector<pair<int, int> > dp(n);
  while (q--) {
    long long b;
    scanf("%I64d", &b);
    if (b >= sum) {
      printf("1\n");
      continue;
    }
    int j = -1;
    long long sm = 0;
    for (int i = 0; i < n; i++) {
      while (sm <= b) {
        j = (j + 1) % n;
        sm += a[j];
      }
      last[i] = j;
      sm -= a[i];
    }
    for (int i = n - 1; i >= 0; i--) {
      if (last[i] <= i) {
        dp[i] = make_pair(1, i);
      } else {
        dp[i] = dp[last[i]];
        dp[i].first++;
      }
    }
    int lim = last[0];
    int mn = 10000000;
    for (int i = 0; i <= lim; i++) {
      int ans = dp[i].first;
      int lst = dp[i].second;
      if (last[lst] <= lst && last[lst] >= i) {
      } else
        ans++;
      mn = min(mn, ans);
    }
    printf("%d\n", mn);
  }
}
