You are given a sequence A of length n and a number k. A number A[l] is special if there exists a contiguous subarray that contains exactly k numbers that are strictly greater than A[l]. The specialty of a sequence is the sum of special numbers that are available in the sequence. Your task is to determine the specialty of the provided sequence.
Input format
Constraints
1≤k≤n≤105
−109≤A[l]≤109 for all array indices l
The beauty will be 4+3+2=9.
For 4, subsequence is [4,3,2,7,8]
For 3, subsequence is [3,2,7,8]
For 2, subsequence is [2,7,8]
For 7,8 there do not exist such subsequences.