#include <stdio.h>

int main()
{
  int i, n, q, left, right;
  long cnt, sum, x;
  scanf("%d %d", &n, &q);
  long a[n];
  for (i=0; i<n; i++) scanf("%ld", &a[i]);
  for (i=0; i<q; i++) {
    scanf("%ld", &x);
    cnt = sum = 0;
    for (left=0, right=0; left<n; cnt+=right-left++) {
      for (; right<n && sum+a[right]<=x; sum += a[right++]);  
      sum -= a[left];
    }
    printf("%ld\n", cnt);
  }
  return 0;
}

