#include <stdio.h>          // printf(), scanf()
#define MAX_N 100000

int
main(int argc, char** argv)
{
	int n, q;
	int a[MAX_N];
	int i;

	scanf("%d %d", &n, &q);
	for (i = 0; i < n; ++i)
		scanf("%d", &a[i]);

	for (i = 0; i < q; ++i)
	{
		long x;

		scanf("%ld", &x);
		long count = 0;
		long sum = 0;
		int s, t;
		for (s = 0, t = 0; s < n; ++s)
		{
			sum += a[s];
			while (sum > x)
				sum -= a[t++];

			count += s - t + 1;
		}

		printf("%ld\n", count);
	}

	return 0;
}