#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int N = 5e4 + 5;
int qwq,n,k,a[N],st[N][20],lg[N],x,y;
ll cnt,ans;
int get(int x,int y){return (a[x] < a[y] ? x : y);}
int query(int l,int r){
int k = lg[r - l + 1];
return get(st[l][k],st[r - (1 << k) + 1][k]);
}
void dfs(int l,int r){
if(x && y)return;
int pos = query(l,r);
if(pos != l){
int lpos = query(l,pos - 1);
if(a[pos] != a[lpos]){
x = pos,y = lpos;
return;
}else dfs(l,pos - 1);
}
if(pos != r){
int rpos = query(pos + 1,r);
if(a[pos] != a[rpos]){
x = pos,y = rpos;
return;
}else dfs(pos + 1,r);
}
}
bool check(int x,int l,int r){
int pos = query(l,r);
bool flag = true;
if(pos != l){
int lpos = query(l,pos - 1);
flag &= ((a[lpos] + x) % (a[pos] + x) == 0);
flag &= check(x,l,pos - 1);
}
if(pos != r){
int rpos = query(pos + 1,r);
flag &= ((a[rpos] + x) % (a[pos] + x) == 0);
flag &= check(x,pos + 1,r);
}
return flag;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> qwq;
while(qwq--){
cin >> n >> k;
lg[0] = -1;
for(int i = 1;i <= n;i++)cin >> a[i],lg[i] = lg[i >> 1] + 1,st[i][0] = i;
if(*max_element(a + 1,a + n + 1) == *min_element(a + 1,a + n + 1)){
cout << k << " " << 1ll * k * (k + 1) / 2 << endl;
continue;
}
for(int j = 1;j <= lg[n];j++){
for(int i = 1;i + (1 << j) - 1 <= n;i++)st[i][j] = get(st[i][j - 1],st[i + (1 << j - 1)][j - 1]);
}
x = y = 0;
dfs(1,n);
assert(x && y);
x = a[x],y = a[y];
cnt = ans = 0;
for(int i = 1;i * i <= y - x;i++){
if((y - x) % i == 0){
int t = i - x;
if(t <= k && t > 0 && check(t,1,n))ans += t,cnt++;
t = (y - x) / i - x;
if(i * i != y - x && t <= k && t > 0 && check(t,1,n))ans += t,cnt++;
}
}
cout << cnt << " " << ans << endl;
}
}