#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int N = 1e6 + 10;
const long long mod = 1e9 + 7;
void read(int &x) {
  int f = 1;
  x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') x = x * 10 + s - '0', s = getchar();
  x *= f;
}
int a[maxn], n, r, m;
bool ck(int x) {
  int k = a[m - x] - r * x;
  if (k <= 0) return 1;
  return 0;
}
int main() {
  int t;
  read(t);
  while (t--) {
    read(n);
    read(r);
    for (int i = 1; i <= n; i++) read(a[i]);
    sort(a + 1, a + 1 + n);
    m = unique(a + 1, a + 1 + n) - a - 1;
    int l = 1, r = m;
    int ans = 0;
    while (l <= r) {
      if (ck(((l + r) >> 1))) {
        ans = ((l + r) >> 1);
        r = ((l + r) >> 1) - 1;
      } else
        l = ((l + r) >> 1) + 1;
    }
    printf("%d\n", l);
  }
}
