#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<ll> a, x;

ll solve(ll x) {
    int left = 0, right = 0;
    int n = a.size();
    ll ans = 0;

    ll localsum = 0;
    for (left = 0; left < n; left++) {
        while (right < n) {
            if (localsum + a[right] <= x) {
                localsum += a[right];
                right++;
            } else {
                break;
            }
        }
        localsum -= a[left];
        ans += (right - left);
    }
    return ans;
}

int main(int argc, char** argv) {
    int n, q;
    cin >> n >> q;
    a.resize(n);
    x.resize(n);

    rep(i, n) { cin >> a[i]; }
    rep(i, q) { cin >> x[i]; }
    rep(i, q) { cout << solve(x[i]) << endl; }
    return 0;
};

