Large subarray - MarisaOJ: Marisa Online Judge

Large subarray

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ of $n$ positive integers. Calculate the number of subarray with sum larger or equal to $k$. ### Input - The first line contains 2 integer $n, k$. - The second line contains $n$ space-separated integers $A_i$. ### Output - Print an integer, the number of subarray with sum larger or equal to $k$. ### Constraints - $1 \le n \le 10^{5}$. - $1 \le A_i, k \le 10^9$. ### Example Input: ``` 5 6 1 2 1 4 5 ``` Output: ``` 6 ```