#include <bits/stdc++.h>
using namespace std;
int n, ss;
long long l[1000007];
int zas[1000007];
int nix[1000007];
long long r;
long long summa = 0;
inline int poz(int x) {
  while (x > n) x -= n;
  return x;
}
inline int f(int x) {
  int res = 0;
  int skok = 0;
  while (skok < n) {
    skok += nix[x];
    x = zas[x];
    res++;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> ss;
  for (int i = 1; i <= n; ++i) {
    cin >> l[i];
    summa += l[i];
  }
  while (ss--) {
    cin >> r;
    if (r >= summa) {
      cout << "1\n";
      continue;
    }
    int j = 1;
    long long sum = 0;
    int len = 0;
    int lenmin = n + 7;
    int st = 0;
    for (int i = 1; i <= n; ++i) {
      while (sum + l[j] <= r) {
        sum += l[j];
        len++;
        j = poz(j + 1);
      }
      if (len < lenmin) {
        lenmin = len;
        st = i;
      }
      nix[i] = len;
      zas[i] = j;
      sum -= l[i];
      len--;
    }
    int wynik = n + 7;
    int stop = zas[st];
    while (1) {
      wynik = min(wynik, f(st));
      if (st == stop) break;
      st = poz(st + 1);
    }
    cout << wynik << '\n';
  }
  return 0;
}
