100 atcoder#ABC130D. [ABC130D] Enough Array

[ABC130D] Enough Array

Score : 400400 points

Problem Statement

You are given a sequence of positive integers of length NN, A=a1,a2,,aNA=a_1,a_2, \cdots ,a_{N}, and an integer KK. How many contiguous subsequences of AA satisfy the following condition?

  • (Condition) The sum of the elements in the contiguous subsequence is at least KK.

We consider two contiguous subsequences different if they derive from different positions in AA, even if they are the same in content.

Note that the answer may not fit into a 3232-bit integer type.

Constraints

  • 1ai1051 \leq a_i \leq 10^5
  • 1N1051 \leq N \leq 10^5
  • 1K10101 \leq K \leq 10^{10}

Input

Input is given from Standard Input in the following format:

NN KK

a1a_1 a2a_2 ...... aNa_N

Output

Print the number of contiguous subsequences of AA that satisfy the condition.

4 10
6 1 2 7
2

The following two contiguous subsequences satisfy the condition:

  • A[1..4]=a1,a2,a3,a4A[1..4]=a_1,a_2,a_3,a_4, with the sum of 1616
  • A[2..4]=a2,a3,a4A[2..4]=a_2,a_3,a_4, with the sum of 1010
3 5
3 3 3
3

Note again that we consider two contiguous subsequences different if they derive from different positions, even if they are the same in content.

10 53462
103 35322 232 342 21099 90000 18843 9010 35221 19352
36