#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n, r;
    cin >> n >> r;
    vector<int> vec(n, 0);
    for (int i = 0; i < n; ++i) {
      cin >> vec[i];
    }
    sort(vec.begin(), vec.end());
    int ans = 0;
    int cur = 0;
    int i = 0, j = vec.size() - 1;
    while (i < j || (i == j && cur < vec[i])) {
      cur += r;
      i = upper_bound(vec.begin(), vec.end(), cur) - vec.begin();
      j = lower_bound(vec.begin(), vec.end(), vec[j]) - vec.begin() - 1;
      ans += 1;
    }
    cout << ans << endl;
  }
}
