#include <iostream>
#include <vector>
#include <climits>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	long long N, Q; cin >> N >> Q;
	vector<long long> a(N, 0);
	for (int i = 0; i < N;i++) {
		cin >> a[i];
	}
	for (int i = 0; i < Q;i++) {
		long long ans = 0, sum = 0,left = 0, q; cin >> q;
		for (int right = 0; right < N;right++) {
			sum += a[right];
			while (sum > q) {
				ans += right - left;
				sum -= a[left];
				left++;
			}
		}
		while (left < N) {
			ans += N - left;
			left++;
		}
		cout << ans << endl;
	}
}