
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
    int N, Q;
    cin >> N >> Q;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];

    vector<ll> sa(N);
    sa[0] = a[0];
    for (int i = 1; i < N; i++) sa[i] = sa[i - 1] + a[i];

    for (int q = 0; q < Q; q++) {
        ll x;
        cin >> x;
        ll cnt = 0;
        for (int i = 0; i < N; i++) {
            ll dst = i == 0? x: x + sa[i - 1];
            auto lit = begin(sa) + i;
            auto rit = upper_bound(lit, end(sa), dst);
            cnt += (ll)(rit - lit);
        }
        cout << cnt << endl;
    }

    return 0;
}