#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
long long a[MAXN], Sum[MAXN], onLine[MAXN], residue[MAXN];
int main() {
  int N, Q;
  scanf("%d%d", &N, &Q);
  Sum[0] = 0;
  for (int i = 1; i <= N; i++) {
    scanf("%I64d", &a[i]);
    Sum[i] = Sum[i - 1] + a[i];
  }
  for (int t = 1; t <= Q; t++) {
    long long b;
    scanf("%I64d", &b);
    onLine[N + 1] = 0;
    onLine[N] = 1;
    residue[N] = a[N];
    int r = N;
    int l = N;
    while (l > 1) {
      l--;
      while (Sum[r] - Sum[l - 1] > b) r--;
      onLine[l] = onLine[r + 1] + 1;
      if (r == N)
        residue[l] = Sum[N] - Sum[l - 1];
      else
        residue[l] = residue[r + 1];
    }
    long long ans;
    if (Sum[N] > b) {
      ans = onLine[1];
      int i = 2;
      while (Sum[i - 1] < b) {
        long long res = onLine[i];
        if (residue[i] + Sum[i - 1] <= b) ans = min(ans, res);
        i++;
      }
    } else {
      ans = 1;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
