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

ll solve(vector<ll> a,ll k){
    ll res = 0;
    ll sum = 0;
    int r = 0;

    for(int l = 0 ; l < a.size() ; l++ ){

        while(sum + a[r] <= k && r < a.size()){
            sum += a[r];
            r++;
        }
        res += r-l;
    
        sum -= a[l];
    }
    return res;
}

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

    for(int i = 0; i < Q ; i++){
        ll query;cin >> query;
        cout << solve(x,query) << endl;
    }


    return 0;
}
