LearnPy Hub
← Arena
AdvancedRating 1500

Subarrays Summing to K

Count the contiguous subarrays whose sum equals k. Values may be negative.

Input

n k, then n integers.

Output

A count.

Sample 1

Input
3 2
1 1 1
Output
2

Sample 2

Input
3 3
1 2 3
Output
2
solution.py
Output appears here
Subarrays Summing to K · Python Arena problem · LearnPy Hub