#include #define fo(i,a,b) for(int i=a;i<=b;++i) #define fod(i,a,b) for(int i=a;i>=b;--i) using namespace std; typedef long long LL; typedef pair pii; const int N=100500,mo=998244353; int read(int &n) { bool q=0;n=0;char ch=' '; for(;ch!='-'&&(ch<'0'||ch>'9');ch=getchar()); if(ch=='-')ch=getchar(),q=1; for(;ch>='0'&&ch<='9';ch=getchar())n=(n<<3)+(n<<1)+ch-48; return q?n=-n:n; } unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); mt19937 rand_num(seed); // 大随机数 int RD(int q){return rand_num()%q;} struct Val { int l,r; friend bool operator<(Val q,Val w){return q.l>w.l;} }; priority_queued; int n,m,ans; int main() { int q,w,_; read(_); while(_--) { int K; read(n),read(K); fo(i,1,n) { read(q); d.push({q-K,q+K}); } ans=1; int nw=d.top().l; d.pop(); for(++nw;!d.empty();) { Val t=d.top();d.pop(); nw=max(nw,t.l); if(t.r>=nw) { ++nw; ++ans; } } printf("%d\n",ans); } return 0; }