#include #define mp make_pair #define fi first #define se second #define debug(x) cerr << #x << " = " << (x) << endl #define EPS 1e-9 #define PI acos(-1.0) using namespace std; void test() { cerr << endl; } template void test(T x, Args... args) { cerr << x << " "; test(args...); } typedef long long ll; typedef pair pii; typedef pair pll; const int MAXN = (int)1e5 + 10; const int MOD = 998244353; const int INF = 1e9; void Main() { int n, k; cin >> n >> k; vector ve; for (int i = 0; i < n; i++) { int x; cin >> x; ve.push_back({x - k, x + k}); } sort(ve.begin(), ve.end()); int cnt = 1, mi = ve[0].fi; for (int i = 1; i < n; i++) { int l = ve[i].fi, r = ve[i].se; if (mi >= r) continue; if (mi < l) { mi = l; } else { mi++; } cnt++; } cout << cnt << "\n"; } int main() { #ifdef BanFcc freopen("in.txt", "r", stdin); /// freopen("out.txt", "w", stdout); #else ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0); cout << fixed << setprecision(10); #endif int T = 1; cin >> T; for (int ca = 1; ca <= T; ca++) { // cout << "Case #" << ca << ": "; Main(); } return 0; }