#include<bits/stdc++.h>
using namespace std;
#define INFTY 1<<20
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long int ll;
const int MOD=1000000007;

int main(){
    int n,q;cin>>n>>q;

    vector<ll> a(n),x(q),ans(q,0);
    rep(i,n)cin>>a[i];
    rep(i,q)cin>>x[i];
    ll u,sum=0,r=0;
    rep(i,q){
        sum = 0;r = 0;
        u = x[i];
        rep(l,n){
            while(sum+a[r]<=u&&r<n){
                sum += a[r];
                r++;
            }
            if(sum<=u)ans[i] += r-l;
            if(r==l){
                r++;
            }else{
                sum -= a[l];
            }
        }
    }
    rep(i,q)cout<<ans[i]<<endl;
    return 0;
}
