#include <bits/stdc++.h>
using namespace std;
const long long inf = 2e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-12;
const double PI = 2 * acos(0.0);
const double E = 2.71828;
int n, m;
long long a[1000005], cnt[1000005], nxt[1000005];
int main(void) {
  scanf("%d %d", &n, &m);
  long long sm = 0, mx = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%I64d", &a[i]);
    sm += a[i];
    mx = max(mx, a[i]);
  }
  for (int i = 0; i < m; ++i) {
    long long x;
    scanf("%I64d", &x);
    if (x >= sm) {
      puts("1");
      continue;
    }
    for (int j = 0; j < n; ++j) cnt[j] = 0;
    int it = 0, sum = 0;
    for (int j = 0; j < n; ++j) {
      while (sum + a[it] <= x) {
        sum += a[it++];
        if (it == n) it = 0;
      }
      nxt[j] = it;
      sum -= a[j];
    }
    long long cur = 1;
    long long v = 0;
    long long r = 0;
    long long add = 1;
    while (!cnt[v]) {
      cnt[v] = cur++;
      r += add;
      if (v > nxt[v]) {
        add = 0;
      }
      v = nxt[v];
    }
    printf("%I64d\n", min(r, cur - cnt[v]));
  }
  return 0;
}
