#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t, n, i, j;
  long long int *x, *y;
  cin >> t;
  while (t--) {
    long long int r;
    cin >> n >> r;
    x = new long long int[n];
    for (i = 0; i < n; i++) {
      cin >> x[i];
    }
    sort(x, x + n);
    y = new long long int[n];
    long long int k = 0, mid, l;
    y[k++] = x[0];
    for (i = 1; i < n; i++) {
      if (x[i] != x[i - 1]) {
        y[k++] = x[i];
      }
    }
    long long int previ, neww, ans;
    mid = k;
    l = 0;
    ans = k;
    for (i = k - 1; i >= 0; i--) {
      neww = y[i] - (k - 1 - i) * r;
      if (neww <= 0) {
        ans = k - i - 1;
        break;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
