#include using namespace std; const int MOD = 998244353; int fast_pow(int a, int k) { int res = 1; while (k) { if (k & 1) { res = res * 1LL * a % MOD; } a = a * 1LL * a % MOD; k >>= 1; } return res; } int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n, k; cin >> n >> k; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); int ans = 0; int bound = INT_MIN; for (int i = 0; i < n; i++) { if (a[i] - k > bound) { ans++; bound = a[i] - k; } else if (bound + 1 <= a[i] + k) { ans++; bound++; } } cout << ans << '\n'; } return 0; }