#include using namespace std; const int mod = 998244353; int fsp(int x, int k) { int s = 1; while(k) { if(k & 1) s = 1LL * s * x % mod; x = 1LL * x * x % mod, k >>= 1; } return s; } int a[100010]; int main() { int T; scanf("%d", &T); while(T--) { int n, k; scanf("%d%d", &n, &k); for(int i = 1; i <= n; i++) scanf("%d", &a[i]); sort(a + 1, a + 1 + n); int cnt = 0, R = 2e9 + 100; for(int i = n; i >= 1; i--) { int t = min(R - 1, a[i] + k); if(t >= a[i] - k) R = t, ++cnt; } printf("%d\n", cnt); } return 0; }