A class teacher calls the class monitor to assign a task. The task is to make the whole class stand in a row according to the roll number. The class monitor is asked to calculate the total number of roll number pairs \((l,\ r),\ (l\le r)\) such that the absolute difference between the height of the tallest student among roll number l to roll number r and the height of the student whose roll number l is less than or equal to K.
There are \(N\) students in a class. The information of a class is given to you in the form of an array H.
Here, H[i] denotes the height of the student having roll number i.
Input format
- The first line consists of two space-separated integers N denoting the size of the class and K denoting the difference parameter.
- The next \(N\) lines contain information about the class.
- The \(i^{th}\) line represents the height of the student whose roll number is \(i\).
Output format
The output contains a single integer denoting the number of required roll number pairs.
Constraints
\(1\le N\le 1e6\\ 1\le K\le 1e9\\ 1\le i\le N\\ 1\le H[i]\le 1e9\\\)