#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, temp, a, p, n, r, t;
  cin >> q;
  for (int i = 0; i < q; i++) {
    temp = 0;
    cin >> n >> r;
    set<int> s;
    for (int j = 0; j < n; j++) {
      cin >> a;
      s.insert(a);
    }
    p = s.size() - 1;
    for (set<int>::iterator it = s.begin(); it != s.end(); it++) {
      t = *it;
      t = t - (p * r);
      p--;
      if (t > 0) {
        break;
      }
      temp++;
    }
    cout << s.size() - temp << endl;
  }
}
