#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

int syakutori(const vector<int>& a, int x) {
    const int n = a.size();
    int count = 0;

    for (int l = 0, r = 0, sum = 0; l < n; sum -= a[l++]) {
        for (; r < n && sum + a[r] <= x; sum += a[r++])
            ;

        count += r - l;
    }
    return count;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> x(q);
    for (int i = 0; i < q; i++) cin >> x[i];

    for (int i = 0; i < q; i++) {
        cout << syakutori(a, x[i]) << endl;
    }
}

