#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int N;
vector<long long> A(100000);

void solve(long long x) {
    long long ans = 0;
    long long sum = 0;
    int right = 0;
    rep(left, N) {
        while (right < N && sum + A[right] <= x) {
            sum += A[right];
            ++right;
        }
        ans += right - left;
        if (right == left) ++right;
        else sum -= A[left];
    }
    cout << ans << endl;
    return;
}

int main() {
    int Q;
    cin >> N >> Q;
    rep(i, N) cin >> A[i];
    rep(i, Q) {
        long long x;
        cin >> x;
        solve(x);
    }
    return 0;
}

