#include <bits/stdc++.h>
const double EPS = 1e-9;
const double PI = acos(-1.0);
const long long INF = 1070000000LL;
const long long MOD = 1000000007LL;
using namespace std;
int n, q;
long long a[2000010], b[55];
long long sum[2000010];
map<long long, vector<long long> > queryID;
int Q;
long long qs[55];
long long ans[55];
int nx[2000010];
int solve(long long B) {
  int minLen = INF, pos = -1;
  for (int from = 0, to = 0; from < 2 * n; from++) {
    long long target = sum[from] + B;
    while (sum[to] <= target) to++;
    nx[from] = to - 1;
    if (from < n && nx[from] - from < minLen) {
      minLen = nx[from] - from;
      pos = from;
    }
  }
  int res = INF;
  for (long long from = (long long)(pos); from < (long long)(pos + minLen + 1);
       from++) {
    int cur = from % n;
    int goal = cur + n;
    int t = 0;
    while (cur < goal && t < (n + minLen - 1) / minLen) {
      cur = nx[cur];
      t++;
    }
    if (cur >= goal) res = ((res) < (t) ? (res) : (t));
  }
  return res;
}
int main() {
  scanf("%d %d", &n, &q);
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    scanf("%lld", a + i);
  }
  for (long long i = (long long)(0); i < (long long)(q); i++) {
    scanf("%lld", b + i);
    queryID[b[i]].push_back(i);
  }
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    a[i + n] = a[i];
  }
  sum[0] = 0;
  for (long long i = (long long)(0); i < (long long)(n * 2); i++) {
    sum[i + 1] = sum[i] + a[i];
  }
  sum[n * 2 + 1] = INF * INF;
  long long S = sum[n];
  Q = 0;
  for (__typeof((queryID).begin()) it = (queryID).begin();
       it != (queryID).end(); it++) {
    if (it->first < S) {
      qs[Q++] = it->first;
    } else {
      for (__typeof((it->second).begin()) it2 = (it->second).begin();
           it2 != (it->second).end(); it2++) {
        ans[*it2] = 1;
      }
    }
  }
  for (long long _ = (long long)(0); _ < (long long)(Q); _++) {
    long long B = qs[_];
    long long res = solve(B);
    for (__typeof((queryID[B]).begin()) it = (queryID[B]).begin();
         it != (queryID[B]).end(); it++) {
      ans[*it] = res;
    }
  }
  for (long long i = (long long)(0); i < (long long)(q); i++) {
    printf("%lld\n", ans[i]);
  }
}
