Increase count of prefix sum .
if ( m . has ( prefix_sum [ i ] ) ) m . set ( prefix_sum [ i ] , m . get ( prefix_sum [ i ] ) + 1 ) ; else m . set ( prefix_sum [ i ] , 1 ) ; } return sum ; } if ( k == - 1 ) { sum = 0 ; let m = new Map ( ) ; for ( let i = n ; i >= 0 ; i -- ) {