#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int main(){
    ll n,q;
    cin >> n >> q;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    vector<ll> x(q);
    rep(i,q){
        cin >> x[i];
    }
    rep(i,q){
        ll r = 0;
        ll sum = 0;
        ll ans = 0;
        for(ll l=0;l<n;l++)
        {
            while(r<n&&sum+a[r]<=x[i]){
                sum+=a[r];
                r++;
            }
            ans+=r-l;
            sum-=a[l];
        }
        cout << ans << endl;
    }
    return 0;
}
