#include <bits/stdc++.h>
const int maxn = 1e6 + 7;
const int mod = 1e9 + 7;
const double eps = 1e-8;
using namespace std;
int a[maxn];
int n, t;
int visit[maxn];
int main() {
  scanf("%d", &t);
  while (t--) {
    int n, r;
    scanf("%d%d", &n, &r);
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      int temp;
      scanf("%d", &temp);
      if (visit[temp]) continue;
      visit[temp] = 1;
      a[cnt++] = temp;
    }
    n = cnt;
    sort(a, a + n);
    int ans = 0;
    for (int i = n - 1; i >= 0; i--) {
      if (((int)((a[i] - 0.5) / r) + 1) <= n - 1 - i) {
        break;
      }
      ans++;
    }
    cout << ans << endl;
    for (int i = 0; i < n; i++) {
      visit[a[i]] = 0;
    }
  }
  return 0;
}
