You are given an array $a$ of length $n$ and an integer $k.$ Determine the number of subarrays whose sum is equal to $k.$ A subarray is a sequence of consecutive elements of the array.
Input
The first line of the input consists of two integers, $n$ and $k$.
The second line of the input consists of $n$ integers, $a_1, a_2, \dots, a_n.$
Output
Print the answer in one line, the number of subarrays whose sum is equal to $k.$
Constraints
For all cases, $1 \le n \le 10^5, 0 \le k \le 10^5, 0 \le a_i \le 10.$
Sample Test Cases
Input | Output | |
---|---|---|
5 5 1 2 0 2 3 |
3 |
Scoring: Per Subtask
Authored by s17r28
Appeared in 2021 Mini Competition 0