#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int n, r;
    cin >> n >> r;
    vector<int> x(n);
    for (int i = 0; i < n; i++) cin >> x[i];
    sort(x.begin(), x.end());
    for (int i = 0; i < n - 1; i++) {
      if (x[i] == x[i + 1]) {
        x.erase(x.begin() + i);
        i--;
        n--;
      }
    }
    int shots = 0;
    for (;;) {
      if (x.size() == 0) {
        cout << shots << "\n";
        break;
      }
      if ((x[x.size() - 1] - shots * r) <= 0) {
        cout << shots << "\n";
        break;
      }
      int s = x[x.size() - 1];
      while (x[x.size() - 1] == s) x.pop_back();
      shots++;
    }
  }
  return 0;
}
