Given an array with ~N~ elements, find the number of subarrays ~S~ such that ~\max(S) - \min(S) \le K~.
The first line will have space-separated ~N~ ~(1 \le N \le 3 \times 10^6)~ and ~K~ ~(0 \le K \le N)~.
The second line will have the array, with each element being between ~0~ and ~N~, inclusive.
Output the number of distinct subarrays that satisfy the condition. Two subarrays are different if they occupy a different range of elements, even if the elements themselves are the same.
5 2 0 3 2 1 4