#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int n;
ll A[100100];

void solve(ll s)
{
	ll ans=0,S=0;
	int l=0,r=-1;
	while(true)
	{
		while(r<n&&S<=s)
			S+=A[++r];
		//
		if(r>=n) break;
		while(S>s)
		{
			//printf("%d %d %lld\n",r,l,S);
			ans+=r-l;
			S-=A[l++];
		}
	}
	while(l<n)
		ans+=n-(l++);
	printf("%lld\n",ans);
}

int main()
{
	int q,ma=0;
	scanf("%d%d",&n,&q);
	for(int i=0;i<n;i++)
		scanf("%lld",&A[i]);
	for(int i=0;i<q;i++)
	{
		ll s;
		scanf("%lld",&s);
		solve(s);
	}
	return 0;
}