#include <bits/stdc++.h>
using namespace std;
#define int              long long int
#define double           long double


const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int MAXN = 100000;
const int LINF = 2000000000000000001;

//_ ***************************** START Below *******************************



vector<int> a;


//* Template1 for Atmost k (i.e. <= k )

int consistency1(int n, int k){

	//* up => [1 , 2 , 4 , ... ] => mini = up.front()
	//* down => [ 5 , 3, 2 ... ] => maxi = down.front()
	deque<int> up, down; //* indices
	
	int s = 0, e = 0;
	int ans = 0;
	while(e<n){
		
		//* Calculate state => invalidate dq
	    while(!down.empty() && a[e] >  a[down.back()] ){
	        down.pop_back();
	    }    
	    down.push_back(e);	
	    while(!up.empty() && a[e] < a[up.back()]){
	        up.pop_back();
	    }
	    up.push_back(e);	
	    
	    
	    //* Valid window => expand + Compute result
	    long long mini = a[up.front()];
	    long long maxi = a[down.front()];
	    
	    if( (maxi-mini) * (e-s+1) <= k){
	        ans += (e-s+1);
	        e++;
	    }
	    else{
	    	//* Invlaid window => Shrink 
	        while(s<=e){
	            long long maxi = a[down.front()];
	            long long mini = a[up.front()];
	            
	            if((maxi-mini) * (e-s+1) <= k) break;	
	            
	            if(up.front() == s) up.pop_front();
	            if(down.front() == s) down.pop_front();
	            s++;
	        }
	        
	        //* valid window => Compute result
	        ans += (e-s+1);
	        e++;
	    }
	}

	return ans;

}







//* Template2 for Atmost k (i.e. <= k )
//* 	(based on Cache Invalidation) 

 
int consistency2(int n, int k){
 
	deque<int> up, down; //* indices
	
	int ans = 0;
	int s=0, e=0;
	while(e<n){
		//* Calculate State => Invalidate dq
	    while(!down.empty() && a[e] >  a[down.back()] ){
	        down.pop_back();
	    }    
	    down.push_back(e);	
	    while(!up.empty() && a[e] < a[up.back()]){
	        up.pop_back();
	    }
	    up.push_back(e);	
	    
	    //* Invalid window => shrink
	    while(s<=e){
	        long long maxi = a[down.front()];
	        long long mini = a[up.front()];
	        
	        if( (maxi-mini) * (e-s+1) <= k) break;
	        
	        if(up.front() == s) up.pop_front();
	        if(down.front() == s) down.pop_front();
	        s++;
	    }	
	    
	    
	    //* Valid window Guranteed => Compute Result
	    ans += (e-s+1);
	    e++;
	}
        
	return ans;
}
 
 
 
 
 
 
 
int practice(int n, int k){
 
	int ans = 0;
	

	return ans;
}
 
 


void solve() {

	int n, k;
	cin >> n >> k;
	a.resize(n);
	for(int i=0; i<n; i++) cin >> a[i];

	cout << consistency1(n, k) << " " << consistency2(n, k) << endl;
	// cout << consistency1(n, k) << " " << practice(n, k) << endl;
	
}





int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}