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

int main(){
    int n, q;
    cin >> n >> q;
    ll a[n], x;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < q; i++){
        cin >> x;
        ll res = 0, sum = 0;
        int right = 0;
        for(int left = 0; left < n; left++){
            while(right < n && sum + a[right] <= x) sum += a[right++];
            res += (right - left);
            if(left == right) right++;
            else sum -= a[left];
        }
        cout << res << endl;
    }
    return 0;
}

