#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
using namespace std;
void solvetestcase(int tcn) {
  int n, r;
  cin >> n >> r;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  vector<int> b;
  int last = -1;
  int i = 0;
  while (i < n) {
    if (a[i] != last) {
      b.push_back(a[i]);
      last = a[i];
    }
    i += 1;
  }
  n = b.size();
  if (n == 1)
    cout << 1 << '\n';
  else {
    for (int i = n - 1; i >= 0; i--) {
      if (i == 0)
        cout << n << '\n';
      else {
        if (b[i - 1] <= (n - i) * r) {
          cout << (n - i) << '\n';
          return;
        }
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  cin >> t;
  for (int T = 1; T < t + 1; T++) {
    solvetestcase(T);
  }
};
