Question
Magical Energy Segments

A treasure hunter is exploring an ancient path filled with magical stones. Each stone has an integer value written on it — positive values give him energy, while negative values drain his energy.

He walks along the path in a straight line and can choose any continuous segment of stones. He wants to know in how many different continuous segments the total energy gained is exactly KaTeX can only parse string typed expression.

Your task is to help him count the number of such continuous segments (subarrays) whose total sum is equal to KaTeX can only parse string typed expression.

Input
The first line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the number of stones and the required total energy.
The second line contains KaTeX can only parse string typed expression integers — KaTeX can only parse string typed expression — where KaTeX can only parse string typed expression represents the energy value of the KaTeX can only parse string typed expression-th stone.
Output
Print a single integer — the number of continuous segments whose total sum is equal to KaTeX can only parse string typed expression.
Example
Input
6 3
1 2 1 1 -1 2

Output
4

Explanation
Valid continuous segments with total energy 3:
From stone 0 to stone 1 → KaTeX can only parse string typed expression
From stone 1 to stone 2 → KaTeX can only parse string typed expression
From stone 2 to stone 5 → KaTeX can only parse string typed expression
From stone 1 to stone 4 → KaTeX can only parse string typed expression
Total valid segments = 4.

Online