#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

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

	rep(j,Q){
		ll x;
		cin>>x;
		ll res=0;
		int right=0;
		ll sum=0;
		rep(left,n){
			while(right<n && sum+a[right]<=x){
				sum+=a[right];
				right++;
			}
			res+=(right-left);
			if(right==left) right++;
			else sum-=a[left];
		}

		cout<<res<<endl;
	}
	
}
