#include using namespace std; typedef long long ll; template ostream &operator<<(ostream &io, vector a) { io << "{"; for (auto I:a)io << I << " "; io << "}"; return io; } template ostream &operator<<(ostream &io, set a) { io << "{"; for (auto I:a)io << I << " "; io << "}"; return io; } template ostream &operator<<(ostream &io, map a) { io << "("; for (auto I:a)io << "{" << I.first << ":" << I.second << "}"; io << ")"; return io; } void debug_out() { cerr << endl; } template void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); } #ifdef local #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 55 #endif #define all(x) x.begin(),x.end() mt19937_64 Rand(123456); ll Range(ll l, ll r) { return l + Rand() % (r - l + 1); } //a+b a-b //2*a 2*b const int mod = 998244353; ll power(ll a,ll b){ ll res = 1; while(b){ if(b&1)res=res*a%mod; a=a*a%mod; b>>=1; } return res; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #ifdef local freopen("../in.txt", "r", stdin); #endif int _;cin>>_; while(_--){ int n,k;cin>>n>>k; vector a(n+1); for(int i =1;i<=n;i++)cin>>a[i]; sort(a.begin()+1,a.end()); int res = 1; int last = a[1] - k; debug(res,last); for(int i =2;i<=n;i++){ int now = last + 1; int L = a[i]-k,R=a[i]+k; if(L<=now&&now<=R){ res++; }else{ if(now>R)now=R; else now = L,res++; } last = now; debug(res,last); } cout<