Little Petya likes points a lot. Recently his mom has presented him *n* points lying on the line *OX*. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exceed *d*.

Note that the order of the points inside the group of three chosen points doesn't matter.

The first line contains two integers: *n* and *d* (1 ≤ *n* ≤ 10^{5}; 1 ≤ *d* ≤ 10^{9}). The next line contains *n* integers *x*_{1}, *x*_{2}, ..., *x*_{n}, their absolute value doesn't exceed 10^{9} — the *x*-coordinates of the points that Petya has got.

It is guaranteed that the coordinates of the points in the input strictly increase.

提交代码