#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000100;
int a[maxN], nxt[maxN];
long long sufSum[maxN], prefSum[maxN];
pair<int, int> dp[maxN];
int solve(int n, long long lim) {
  int ptr = 0;
  long long curSum = 0;
  for (int i = 0; i < (n); ++i) {
    while (ptr < n and curSum + a[ptr] <= lim) {
      curSum += a[ptr];
      ++ptr;
    }
    nxt[i] = -1;
    if (ptr < n and curSum + a[ptr] > lim) {
      nxt[i] = ptr - 1;
    }
    curSum -= a[i];
  }
  for (int i = n - 1; i >= 0; --i) {
    if (nxt[i] == -1) {
      dp[i] = make_pair(i, 0);
    } else {
      dp[i] = make_pair(dp[nxt[i] + 1].first, dp[nxt[i] + 1].second + 1);
    }
  }
  int ans = maxN;
  if (prefSum[n - 1] <= lim) ans = min(ans, 1);
  for (int i = 0; i < (n); ++i) {
    if (i > 0 and prefSum[i - 1] > lim) break;
    if (nxt[i] != -1) {
      if (i == 0) {
        if (sufSum[dp[i].first] <= lim) {
          ans = min(ans, dp[i].second + 1);
        } else {
          assert(false);
        }
      } else {
        if (sufSum[dp[i].first] + prefSum[i - 1] <= lim) {
          ans = min(ans, dp[i].second + 1);
        } else {
          ans = min(ans, dp[i].second + 2);
        }
      }
    }
  }
  return ans;
}
int main() {
  int n, q;
  scanf("%d", &n), scanf("%d", &q);
  for (int i = 0; i < (n); ++i) scanf("%d", &a[i]);
  for (int i = 0; i < (n); ++i) {
    if (i == 0)
      prefSum[i] = a[i];
    else
      prefSum[i] = prefSum[i - 1] + a[i];
  }
  sufSum[n] = 0;
  for (int i = n - 1; i >= 0; --i) {
    sufSum[i] = sufSum[i + 1] + a[i];
  }
  for (int i = 0; i < (q); ++i) {
    long long lim;
    scanf("%lld", &lim);
    printf("%d\n", solve(n, lim));
  }
  return 0;
}
