#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const int MAXN = 1e6 + 10;
int next_start[MAXN];
int blocks[MAXN];
long long in_last[MAXN];
int n, q;
int a[MAXN];
long long suma[MAXN];
void precalc() {
  suma[0] = 0;
  for (int i = 0; i < (int)n; ++i) suma[i + 1] = suma[i] + a[i];
}
long long sum(int l, int r) { return suma[r + 1] - suma[l]; }
int main() {
  cin >> n >> q;
  for (int i = 0; i < (int)n; ++i) {
    scanf("%d", &a[i]);
  }
  precalc();
  for (int it = 0; it < (int)q; ++it) {
    long long b;
    cin >> b;
    blocks[n] = 0;
    in_last[n] = 0;
    next_start[n] = -1;
    next_start[n - 1] = n;
    blocks[n - 1] = 1;
    in_last[n - 1] = a[n - 1];
    for (int i = ((int)n - 1) - 1; i >= 0; --i) {
      next_start[i] = next_start[i + 1];
      while (sum(i, next_start[i] - 1) > b) {
        --next_start[i];
      }
      assert(next_start[i] > i);
      blocks[i] = blocks[next_start[i]] + 1;
      in_last[i] = blocks[i] == 1 ? sum(i, n - 1) : in_last[next_start[i]];
    }
    int ans = (int)1e9;
    long long beg = 0;
    for (int i = 0; i < (int)n; ++i) {
      if (beg > b) {
        break;
      }
      int cur = blocks[i];
      if (in_last[i] + beg > b) {
        ++cur;
      }
      ans = min(ans, cur);
      beg += a[i];
    }
    printf("%d\n", ans);
  }
  return 0;
}
