#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
const int INF = 1000000000;
const int MAX = 2000007;
const int MAX2 = 7000;
const int BASE = 1000000000;
int n, m, cnt, e;
int A[MAX];
int C[MAX];
bool U[MAX];
int ok;
int P[MAX];
vector<int> G[MAX];
int p;
int N[MAX];
int E[MAX];
int F[MAX];
int S[MAX];
int L[MAX];
void dfs(int st) {
  int s = 1;
  S[0] = st;
  while (s > 0) {
    int v = S[s - 1];
    U[v] = 1;
    if (s > cnt) {
      int u = S[s - cnt - 1];
      if (u - v >= n / 2) ok = 1;
    }
    if (F[v] == -1) {
      --s;
    } else {
      S[s++] = E[F[v]];
      F[v] = N[F[v]];
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = (0); i < (n); ++i) {
    scanf("%d", &A[i]);
    A[n + i] = A[i];
  }
  n *= 2;
  for (int i = (0); i < (m); ++i) {
    long long sum;
    cin >> sum;
    long long cur = 0;
    cnt = 1;
    for (int j = (0); j < (n / 2); ++j) {
      if (cur + A[j] > sum) {
        ++cnt;
        cur = A[j];
      } else
        cur += A[j];
    }
    int res = cnt;
    if (cnt > 2) {
      for (int j = (0); j < (n + 1); ++j) {
        U[j] = 0;
        F[j] = N[j] = -1;
        G[j].clear();
      }
      e = 0;
      --cnt;
      long long cur = 0, pos = n - 1;
      for (int j = n - 1; j >= 0; --j) {
        cur += A[j];
        while (cur > sum) {
          cur -= A[pos];
          --pos;
        }
        int w = pos + 1;
        E[e] = j;
        N[e] = F[w];
        F[w] = e;
        ++e;
      }
      ok = 0;
      for (int j = n; j >= 0; --j)
        if (U[j] == 0) {
          dfs(j);
        }
      if (ok) res = cnt;
    }
    cout << res << endl;
  }
  return 0;
}
