#include using namespace std; int a[100010]; int main() { int T; scanf("%d", &T); while (T--) { int n, k; scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } sort(a, a + n); int ans = 0, cur = -0x3f3f3f3f; for (int i = 0; i < n; i++) { int x = a[i] - k; if (cur < x) cur = x, ans++; else { if (abs(a[i] - cur - 1) <= k) cur++, ans++; } } printf("%d\n", ans); } return 0; }