#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool uax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const int MAXN = 2100000;
const int LOG = 7;
int a[MAXN], nxt[MAXN];
int up[LOG][MAXN];
int N, Q;
int m;
int lens(int i) {
  int st = i;
  int res = 0;
  for (int j = (int)(LOG)-1; j >= 0; --j) {
    while (up[j][i] < st + N) {
      i = up[j][i];
      res += (1 << j);
    }
  }
  assert(res < N);
  return res + 1;
}
int main() {
  ios::sync_with_stdio(false);
  cout.precision(10);
  cout << fixed;
  scanf("%d%d", &N, &Q);
  srand(113 * N + 110092 * Q);
  for (int i = 0; i < (int)(N); ++i) scanf("%d", &a[i]);
  for (int i = 0; i < (int)(N); ++i) a[i + N] = a[i];
  long long sum = 0;
  for (int i = 0; i < (int)(N); ++i) sum += a[i];
  for (int i = 0; i < (int)(Q); ++i) {
    long long T;
    scanf("%I64d", &T);
    if (T >= sum) {
      cout << 1 << '\n';
      continue;
    }
    long long S = 0;
    int j = 0;
    for (int i = 0; i < (int)(2 * N); ++i) {
      while (j < 2 * N && S + a[j] <= T) S += a[j++];
      nxt[i] = j;
      S -= a[i];
    }
    nxt[2 * N] = 2 * N;
    for (int j = 0; j < (int)(2 * N + 1); ++j) up[0][j] = nxt[j];
    for (int i = 1; i <= (int)(LOG - 1); ++i)
      for (int j = 0; j < (int)(2 * N + 1); ++j)
        up[i][j] = up[i - 1][up[i - 1][j]];
    m = lens(0);
    int tries = 15 * N / m;
    int st = 0;
    for (int i = 0; i < (int)(tries); ++i) {
      int mm = lens(st);
      st = (1LL * st * 100501 + 59) % N;
      uin(m, mm);
    }
    cout << m << '\n';
  }
  return 0;
}
