#include "bits/stdc++.h"
using namespace std;

int main() {
	int N, Q; cin >> N >> Q;
	vector<long long int>as(N);
	for (int i = 0; i < N; ++i)cin >> as[i];
	while (Q--) {
		auto it = as.begin(); auto jt = as.begin();
		long long int S; cin >> S;
		long long int sum = 0;
		long long int ans = 0;
		while (jt != as.end()) {
			sum += *jt;
			jt++;
			while (sum > S) {
				
				sum -= *it;
				it++;
			}
			ans += jt - it;
		}
		cout << ans << endl;
	}
	
	return 0;
}