#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
using namespace std;
int main() {
	long long n, q,ans=0;
	cin >> n >> q;
	vector<long long>question(q),numbers(n);
	for (int i = 0; i < n; ++i) cin >> numbers[i];
	for (int i = 0; i < q; ++i)cin >> question[i];
	long long sum=0;
	for (int i = 0; i < q; ++i) {
		int right = 0;
		for (int left = 0; left < n; ++left) {
			while (right < n&&sum+numbers[right] <= question[i]) {
				sum += numbers[right++];
			}
			ans += right - left;
			if (right == left)++right;
			else sum -= numbers[left];
		}
		cout << ans << endl;
		ans = 0;
	}
	return 0;
}
