#include <bits/stdc++.h>
using namespace std;
const int N = 2000010;
int a[N], to[N];
long long s[N];
int main() {
int n, tt;
scanf("%d %d", &n, &tt);
for (int i = 0; i < n; i++) {
scanf("%d", a + i);
}
for (int i = 0; i < n; i++) {
a[n + i] = a[i];
}
s[0] = 0;
for (int i = 0; i < 2 * n; i++) {
s[i + 1] = s[i] + a[i];
}
for (int qq = 0; qq < tt; qq++) {
long long b;
cin >> b;
int j = 2 * n;
for (int i = 2 * n - 1; i >= 0; i--) {
while (s[j] - s[i] > b) {
j--;
}
to[i] = j;
}
int best = 0;
for (int i = 1; i < n; i++) {
if (to[i] - i < to[best] - best) {
best = i;
}
}
int ans = n;
int start = best;
for (int z = best; z <= to[best]; z++) {
int steps = 0;
int where = start;
while (where < start + n) {
steps++;
where = to[where];
}
if (steps < ans) {
ans = steps;
}
start++;
if (start >= n) {
start -= n;
}
}
printf("%d\n", ans);
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE4gPSAyMDAwMDEwOwoKaW50IGFbTl0sIHRvW05dOwpsb25nIGxvbmcgc1tOXTsKCmludCBtYWluKCkgewogIGludCBuLCB0dDsKICBzY2FuZigiJWQgJWQiLCAmbiwgJnR0KTsKICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgc2NhbmYoIiVkIiwgYSArIGkpOwogIH0KICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgYVtuICsgaV0gPSBhW2ldOwogIH0KICBzWzBdID0gMDsKICBmb3IgKGludCBpID0gMDsgaSA8IDIgKiBuOyBpKyspIHsKICAgIHNbaSArIDFdID0gc1tpXSArIGFbaV07CiAgfQogIGZvciAoaW50IHFxID0gMDsgcXEgPCB0dDsgcXErKykgewogICAgbG9uZyBsb25nIGI7CiAgICBjaW4gPj4gYjsKICAgIGludCBqID0gMiAqIG47CiAgICBmb3IgKGludCBpID0gMiAqIG4gLSAxOyBpID49IDA7IGktLSkgewogICAgICB3aGlsZSAoc1tqXSAtIHNbaV0gPiBiKSB7CiAgICAgICAgai0tOwogICAgICB9CiAgICAgIHRvW2ldID0gajsKICAgIH0KICAgIGludCBiZXN0ID0gMDsKICAgIGZvciAoaW50IGkgPSAxOyBpIDwgbjsgaSsrKSB7CiAgICAgIGlmICh0b1tpXSAtIGkgPCB0b1tiZXN0XSAtIGJlc3QpIHsKICAgICAgICBiZXN0ID0gaTsKICAgICAgfQogICAgfQogICAgaW50IGFucyA9IG47CiAgICBpbnQgc3RhcnQgPSBiZXN0OwogICAgZm9yIChpbnQgeiA9IGJlc3Q7IHogPD0gdG9bYmVzdF07IHorKykgewogICAgICBpbnQgc3RlcHMgPSAwOwogICAgICBpbnQgd2hlcmUgPSBzdGFydDsKICAgICAgd2hpbGUgKHdoZXJlIDwgc3RhcnQgKyBuKSB7CiAgICAgICAgc3RlcHMrKzsKICAgICAgICB3aGVyZSA9IHRvW3doZXJlXTsKICAgICAgfQogICAgICBpZiAoc3RlcHMgPCBhbnMpIHsKICAgICAgICBhbnMgPSBzdGVwczsKICAgICAgfQogICAgICBzdGFydCsrOwogICAgICBpZiAoc3RhcnQgPj0gbikgewogICAgICAgIHN0YXJ0IC09IG47CiAgICAgIH0KICAgIH0KICAgIHByaW50ZigiJWRcbiIsIGFucyk7CiAgfQogIHJldHVybiAwOwp9