#include <bits/stdc++.h>
using namespace std;
bool check(long long int mid, long long int r, vector<long long int>& a) {
  long long int d = 0;
  long long int cnt = 0;
  for (long long int i = a.size() - 1; i >= 0; i--) {
    if (a[i] - d <= 0)
      continue;
    else {
      if (cnt < mid) {
        d += r;
        cnt++;
      } else
        return false;
    }
  }
  return true;
}
void solve() {
  long long int n, r;
  cin >> n >> r;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  long long int tl = -1, tr = 1e9;
  while (tr - tl > 1) {
    long long int mid = (tl + tr) / 2;
    if (check(mid, r, a))
      tr = mid;
    else
      tl = mid;
  }
  cout << tr << "\n";
}
signed main() {
  long long int t;
  cin >> t;
  for (long long int i = 0; i < t; i++) solve();
  return 0;
}
