#include <stdio.h>
#define N_MAX 100001

int main() {
    int n, q, a[N_MAX];
    scanf("%d%d", &n, &q);
    for (int i=0; i<n; i++) scanf("%d", a+i);
    while (q--) {
        int s = 0, t = 0;
        long x, res = 0, sum = 0;
        scanf("%ld", &x);
        for (;;) {
            while (t <= n && sum <= x) {
                sum += a[t++];
            }
            if (s == t) break;
            sum -= a[s++];
            res += t - s;
        }
        printf("%ld\n", res);
    }
}

