There are N grenades laid out in a row on a weapons store shelf, and the blast radius of fragments of the i-th grenade is ri meters. You can take any number of grenades into a loadout, as long as the blast radii of any two grenades differ by at least K meters.
Kima needs to assemble a loadout of at least two grenades, but she does not want to think through all possible combinations. Kima is interested in sets of grenades that lie next to each other on the shelf. How many loadout options can Kima assemble?
Input
The first line contains two integers N and K — the number of grenades on the shelf and the minimum possible difference between blast radii in the loadout (2 ≤ N ≤ 105, 0 ≤ K ≤ 109).
The second line contains N integers ri — the blast radius of the i-th grenade (1 ≤ ri ≤ 109).
Output
Print the number of ways to assemble a loadout.
Sample
| input | output |
|---|
5 3
1 7 4 8 1
| 6
|
Notes
In the sample, the following loadouts can be assembled: [1,7];[1,7,4];[7,4];[4,8];[4,8,1];[8,1].
Problem Author: Vadim Barinov
Problem Source: The 2026 ICPC UrFU Qualification