#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long a[n];
    vector<long long> raj;
    set<long long> s;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      s.insert(a[i]);
    }
    sort(a, a + n);
    for (auto it = s.begin(); it != s.end(); it++) {
      if ((*it) % k == 0)
        raj.push_back((*it) / k);
      else {
        raj.push_back((*it) / k + 1);
      }
    }
    sort(raj.begin(), raj.end());
    long long cnt = 0;
    for (long long i = raj.size() - 1; i >= 0; i--) {
      if ((raj[i] - cnt) <= 0) {
        break;
      } else
        cnt++;
    }
    cout << cnt << "\n";
  }
}
