#include <bits/stdc++.h>
using namespace std;


long long solve(long long x, const vector<long long> & As){
    long long count = 0;
    long long cum = 0;
    long long tail = 0;
    for (long long head = 0; head < As.size(); ++head){
        while (tail < As.size() and cum < x){
            cum += As[tail];
            ++tail;
        }
        count += tail - head;
        if (cum > x) --count;
        cum -= As[head];
    }
    return count;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, Q;
    cin >> N >> Q;
    vector<long long> As(N);
    vector<long long> Xs(Q);
    for (auto & a : As) cin >> a;
    for (auto & x : Xs) cin >> x;
    for (auto x : Xs) cout << solve(x, As) << '\n';
    return 0;
}