#include <bits/stdc++.h>
using namespace std;
const int limit = 1e7 + 1;
const int inf = 1e7;
const int mod = 1e9 + 7;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, r;
    cin >> n >> r;
    set<long long int> a;
    for (int i = 0; i < n; i++) {
      long long int x;
      cin >> x;
      a.insert(x);
    }
    n = a.size();
    long long int minm = n;
    long long int i = 0;
    if (n == 1) {
      cout << 1 << "\n";
    } else {
      for (auto it : a) {
        if (it - (n - i - 1) * r <= 0) {
          minm = min(minm, (n - i - 1));
        } else {
          break;
        }
        i++;
      }
      cout << minm << "\n";
    }
  }
  return 0;
}
