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


long long shakutori(vector<long long> a, long long x) {
    long long res = 0;
    long long n = a.size();

    long long right = 0, sum = 0;
    for (long long left = 0; left < n; left++) {
        while (right < n && sum + a[right] <= x) {
            sum += a[right];
            right++;
        }

        res += (right - left);

        if (right == left) right++;
        else sum -= a[left];
    }

    return res;
}

int main() {
    long long n, q;
    cin >> n >> q;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (long long i = 0; i < q; i++) {
        long long x;
        cin >> x;
        cout << shakutori(a, x) << endl;
    }
}
