#include using namespace std; int a[100010]; int q, w; int main() { int t; cin >> t; while (t--) { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); q = 0; w = 1000000001; int ans=0, pos=0; a[0] = -1; for (int i = 1; i <= n; i++) { int l = a[i] - k; int r = a[i] + k; if (i == 1) { ans++; pos = l; } else if (l == q && r == w) { if (pos < r) { ans++; pos++; } } else if (l > q && l <= w) { if (pos >= l && pos <= r) { ans++; pos++; } else if (pos < l) { pos = l; ans++; } } else if (l > w) { pos = l; ans++; } q = l; w = r; } if (ans <= n) cout << ans << endl; else cout << n << endl; } return 0; }