Micro has made a breakthrough. He made a function which he proudly calls Micro's Array Fucntion. It takes an array of integers A and an integer K as input and optimally finds out the number of unordered pairs (i,j),i≠j such that |A[i]−A[j]|≥K.
Micro is getting a lot of recognition because of it. His best friend Mike wants to be a part of it, but for that he needs to make some contribution. He thought of extending Micro's Array function. He wants to make a new function g(A,K) that also takes an array of integers A and an integer K as input and optimally calculates ∑f(X,K) for all contiguous subarrays X of A. He need your help in this and help here means do the entire task. He'll give you an integer K and an array A having N integers and you need to compute g(A,K).
Input:
First line consists of a single integers T denoting the number of test cases.
First line of each test case consists of two space separated integer denoting N and K.
Second line of each test case consists of a N space separated integers denoting the array A.
Output:
For each test case, print the value of g(A,K) in a new line.
Constraints:
1≤T≤5
1≤N≤105
1≤A[i],K≤109
X=[1], f(X,K)=0
X=[2], f(X,K)=0
X=[3], f(X,K)=0
X=[1,2], f(X,K)=0
X=[2,3], f(X,K)=0
X=[1,2,3] , f(X,K)=1