import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) {
		FastScanner input = new FastScanner();
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			int r = input.nextInt();
			int ans = 0;
			int[] a = new int[N];
			int seen = 0; //Number of distinct monsters encountered
			for (int j = 0; j < N; j++) a[j]=input.nextInt();
			Arrays.sort(a);
			for (int R = N-1; R>=0; R--) {
				if (R>=1&&a[R]==a[R-1]) continue;
				else {
					seen++;
					int shift = a[R]/r; //Number of shots to kill monster i using shift skill
					if (a[R]%r!=0) shift++;
					int curans = Math.min(shift, seen);
					ans=Math.max(curans, ans);
				}
			}
			w.println(ans);
			w.flush();
		}
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) {
		FastScanner input = new FastScanner();
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			int r = input.nextInt();
			int ans = 0;
			int[] a = new int[N];
			int seen = 0; //Number of distinct monsters encountered
			for (int j = 0; j < N; j++) a[j]=input.nextInt();
			Arrays.sort(a);
			for (int R = N-1; R>=0; R--) {
				if (R>=1&&a[R]==a[R-1]) continue;
				else {
					seen++;
					int shift = a[R]/r; //Number of shots to kill monster i using shift skill
					if (a[R]%r!=0) shift++;
					int curans = Math.min(shift, seen);
					if (curans<ans) break;
					ans=Math.max(curans, ans);
				}
			}
			w.println(ans);
			w.flush();
		}
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			int r = input.nextInt();
			int ans = 0;
			int[] a = new int[N];
			int seen = 0; //Number of distinct monsters encountered
			for (int j = 0; j < N; j++) a[j]=input.nextInt();
			Arrays.sort(a);
			for (int R = N-1; R>=0; R--) {
				if (R>=1&&a[R]==a[R-1]) continue;
				else {
					seen++;
					int shift = a[R]/r; //Number of shots to kill monster i using shift skill
					if (a[R]%r!=0) shift++;
					int curans = Math.min(shift, seen);
					ans=Math.max(curans, ans);
				}
			}
			w.println(ans);
			w.flush();
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) {
		FastScanner input = new FastScanner();
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			int r = input.nextInt();
			int ans = 0;
			Integer[] a = new Integer[N];
			int seen = 0; //Number of distinct monsters encountered
			for (int j = 0; j < N; j++) a[j]=input.nextInt();
			Arrays.sort(a);
			for (int R = N-1; R>=0&&a[R]/r>0; R--) {
				if (R>=1&&a[R]==a[R-1]) continue;
				else {
					seen++;
					int shift = a[R]/r; //Number of shots to kill monster i using shift skill
					if (a[R]%r!=0) shift++;
					int curans = Math.min(shift, seen);
					if (curans<ans) break;
					ans=Math.max(curans, ans);
				}
			}
			w.println(ans);
			w.flush();
		}
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) { //TreeSet and HashSet(I suppose all sets)
		//don't permit storage of duplicate values
		FastScanner input = new FastScanner();
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			long r = input.nextLong();
			long ans = 0;
			TreeSet<Long> set = new TreeSet<Long>(Collections.reverseOrder());
			for (int j = 0; j < N; j++) set.add(input.nextLong());
			while (!set.isEmpty()) {
				long cur = set.pollFirst();
				if (cur-ans*r>0) ans++;
				else break;
			}
			w.println(ans);
			w.flush();
		}
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) {
		FastScanner input = new FastScanner();
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			int r = input.nextInt();
			int ans = 0;
			int[] a = new int[N];
			int seen = 0; //Number of distinct monsters encountered
			for (int j = 0; j < N; j++) a[j]=input.nextInt();
			Arrays.sort(a);
			for (int R = N-1; R>=0; R--) {
				if (R>=1&&a[R]==a[R-1]) continue;
				else {
					if (a[R]-ans*r<=0) break;
					seen++;
					int shift = a[R]/r; //Number of shots to kill monster i using shift skill
					if (a[R]%r!=0) shift++;
					int curans = Math.min(shift, seen);
					if (curans<ans) break;
					ans=Math.max(curans, ans);
				}
			}
			w.println(ans);
			w.flush();
		}
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) {
		FastScanner input = new FastScanner();
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			int r = input.nextInt();
			int ans = 0;
			Integer[] a = new Integer[N];
			int seen = 0; //Number of distinct monsters encountered
			for (int j = 0; j < N; j++) a[j]=input.nextInt();
			Arrays.sort(a);
			for (int R = N-1; R>=0; R--) {
				if (R>=1&&a[R]==a[R-1]) continue;
				else {
					seen++;
					int shift = a[R]/r; //Number of shots to kill monster i using shift skill
					if (a[R]%r!=0) shift++;
					int curans = Math.min(shift, seen);
					if (curans<ans) break;
					ans=Math.max(curans, ans);
				}
			}
			w.println(ans);
			w.flush();
		}
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			int r = input.nextInt();
			int ans = 0;
			PriorityQueue<Integer> pos = new PriorityQueue<Integer>(Collections.reverseOrder());
			HashSet<Integer> seen = new HashSet<Integer>(); //Number of distinct monsters encountered
			for (int j = 0; j < N; j++) pos.add(input.nextInt());
			while (!pos.isEmpty()) {
				int cur = pos.poll();
				seen.add(cur);
				int curans = cur/r;
				if (cur%r!=0) curans++; //Number of shots to kill monster i using shift skill
				curans = Math.min(curans, seen.size()); //Picking off distinct
				//monsters one by one in decreasing order is another potentially optimal solution
				ans=Math.max(curans, ans);
			}
			System.out.println(ans);
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) {
		FastScanner input = new FastScanner();
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			int r = input.nextInt();
			int ans = 0;
			Integer[] a = new Integer[N];
			int seen = 0; //Number of distinct monsters encountered
			for (int j = 0; j < N; j++) a[j]=input.nextInt();
			Arrays.sort(a);
			for (int R = N-1; R>=0&&a[R]-r*seen>0; R--) {
				if (R>=1&&a[R]==a[R-1]) continue;
				else {
					seen++;
					int shift = a[R]/r; //Number of shots to kill monster i using shift skill
					if (a[R]%r!=0) shift++;
					int curans = Math.min(shift, seen);
					if (curans<ans) break;
					ans=Math.max(curans, ans);
				}
			}
			w.println(ans);
			w.flush();
		}
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) { //TreeSet and HashSet(I suppose all sets)
		//don't permit storage of duplicate values
		Scanner input = new Scanner(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		while (T-->0) {
			int N = input.nextInt();
			long r = input.nextLong();
			long ans = 0;
			TreeSet<Long> set = new TreeSet<Long>(Collections.reverseOrder());
			for (int j = 0; j < N; j++) set.add(input.nextLong());
			while (!set.isEmpty()) {
				long cur = set.pollFirst();
				if (cur-ans*r>0) ans++;
				else break;
			}
			w.println(ans);
			w.flush();
		}
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int T = input.nextInt();
		for (int i = 1; i <= T; i++) {
			int N = input.nextInt();
			int r = input.nextInt();
			int ans = 0;
			int[] a = new int[N];
			int seen = 0; //Number of distinct monsters encountered
			for (int j = 0; j < N; j++) a[j]=input.nextInt();
			Arrays.sort(a);
			for (int R = N-1; R>=0; R--) {
				if (R>=1&&a[R]==a[R-1]) continue;
				else {
					seen++;
					int shift = a[R]/r; //Number of shots to kill monster i using shift skill
					if (a[R]%r!=0) shift++;
					int curans = Math.min(shift, seen);
					ans=Math.max(curans, ans);
				}
			}
			System.out.println(ans);
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;
public class KillEmAll {

	public static void main(String[] args) { //TreeSet and HashSet(I suppose all sets)
		//don't permit storage of duplicate values
		FastScanner input = new FastScanner();
		PrintWriter w = new PrintWriter(System.out);
		int T = input.nextInt();
		while (T-->0) {
			int N = input.nextInt();
			long r = input.nextLong();
			long ans = 0;
			TreeSet<Long> set = new TreeSet<Long>(Collections.reverseOrder());
			for (int j = 0; j < N; j++) set.add(input.nextLong());
			while (!set.isEmpty()) {
				long cur = set.pollFirst();
				if (cur-ans*r>0) ans++;
				else break;
			}
			w.println(ans);
			w.flush();
		}
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.io.*;
import java.util.*;
public class vk18
{
    public static void main(String[]st) throws Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int q;
        String []s;
        HashSet<Integer> h;
        q=Integer.parseInt(br.readLine());
        while(q!=0)
        {
            int n,r,m=0,i;
            s=br.readLine().split(" ");
            n=Integer.parseInt(s[0]);
            r=Integer.parseInt(s[1]);
            s = br.readLine().split(" ");
            int p;
            h=new HashSet<>();
            for(i=0;i<s.length;i++) {  h.add(Integer.parseInt(s[i])); }
            int count=0;
            ArrayList<Integer> al=new ArrayList<>(h);
            Collections.sort(al);
            for(i=al.size()-1;i>=0;i--)
            {
                if(al.get(i)-m > 0){ count++; m+=r; }
                else break;
            }
            System.out.println(count);
            q--;
        }
    }
}


import java.io.*;
import java.util.*;
public class vk18
{
    public static void main(String[]st)
    {
        Scanner scan=new Scanner(System.in);
        long q;
        q=scan.nextLong();
        while(q!=0)
        {
            int n,r,m=0,i;
            n=scan.nextInt();
            r=scan.nextInt();
            HashSet<Integer> h=new HashSet<>();
            for(i=0;i<n;i++) h.add(scan.nextInt());
            int count=0;
            ArrayList<Integer> al=new ArrayList<>(h);
            Collections.sort(al);
            for(i=al.size()-1;i>=0;i--)
            {
                if(al.get(i)-m > 0){ count++; m+=r; }
                else break;
            }
            System.out.println(count);
            q--;
        }
    }
}


import java.io.*;
import java.util.*;
public class check
{
    public static void main(String[]st) throws Exception
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int q;
        String []s;
        q=Integer.parseInt(br.readLine());
        while(q!=0)
        {
            int n,r,m=0,i;
            s=br.readLine().split(" ");
            n=Integer.parseInt(s[0]);
            r=Integer.parseInt(s[1]);
            s = br.readLine().split(" ");
            int p;
            HashSet<Integer> h=new HashSet<>();
            for(i=0;i<s.length;i++) {  h.add(Integer.parseInt(s[i])); }
            int count=0;
            ArrayList<Integer> al=new ArrayList<>(h);
            Collections.sort(al);
            for(i=al.size()-1;i>=0;i--)
            {
                if(al.get(i)-m > 0){ count++; m+=r; }
                else break;
            }
            System.out.println(count);
            q--;
        }
    }
}


import java.io.*;
import java.util.*;
public class check
{
    public static void main(String[]st)
    {
        Scanner scan=new Scanner(System.in);
        long q;
        q=scan.nextLong();
        while(q!=0)
        {
            int n,r,m=0,i;
            n=scan.nextInt();
            r=scan.nextInt();
            int p;
            ArrayList<Integer> al=new ArrayList<>();
            //HashSet<Integer> h=new HashSet<>();
            for(i=0;i<n;i++) { p=scan.nextInt(); if(!al.contains(p)) al.add(p);  }
            int count=0;

            Collections.sort(al);
            for(i=al.size()-1;i>=0;i--)
            {
                if(al.get(i)-m > 0){ count++; m+=r; }
                else break;
            }
            System.out.println(count);
            q--;
        }
    }
}


import java.io.*;
import java.util.*;
import java.lang.*;
public class GFG {

	public static void main (String[] args) {
	PrintWriter pw=new PrintWriter(System.out);
	Scanner sc=new Scanner(System.in);
	int q=sc.nextInt();
    for(int i=0;i<q;i++)
       {   TreeSet<Integer> t=new TreeSet<>();
           //int count=0;
           int n=sc.nextInt();
           int r=sc.nextInt();
           int r1=r;
           for(int j=0;j<n;j++)
              t.add(sc.nextInt());
              int n1=t.size();
              int[] a=new int[n1];
              for(int i1=0;i1<n1;i1++)
                 a[i1]=t.pollLast();
                int count=1;
                for(int i1=1;i1<n1;i1++){
                    if(a[i1]-r<=0)
                       break;
                       count++;
                       r+=r1;
                }
                //for(int i1=0;i1<n1;i1++)
                pw.println(count);
                t.clear();
                a=null;
       }

	pw.close();
	}

}


import java.util.Scanner;
import java.util.TreeSet;

public class CF1238B {
	static Scanner input = new Scanner(System.in);
	static int n, r, x, y;

	public static void main(String[] args) {
		int q = input.nextInt();
		for (int ii = 0; ii < q; ++ii) {
			TreeSet<Integer> t = new TreeSet<Integer>();
			n = input.nextInt();
			r = input.nextInt();
			int r1 = r;
			for (int i = 0; i < n; i++)
				t.add(input.nextInt());
			int len = t.size();
			int[] a = new int[len];
			for (int i = 0; i < len; i++)
				a[i] = t.pollLast();
			int count = 1;
			for (int i = 1; i < len; i++) {
				if (a[i] - r <= 0)
					break;
				count++;
				r += r1;
			}
			System.out.println(count);
			t.clear();
			a = null;
		}
	}
}


import java.io.PrintWriter;
import java.util.Scanner;
import java.util.TreeSet;

public class CF1238B {

	public static void main(String[] args) {
		PrintWriter out = new PrintWriter(System.out);
		Scanner input = new Scanner(System.in);
		int n, r;
		int q = input.nextInt();
		for (int ii = 0; ii < q; ++ii) {
			TreeSet<Integer> t = new TreeSet<>();
			n = input.nextInt();
			r = input.nextInt();
			int r1 = r;
			for (int i = 0; i < n; i++)
				t.add(input.nextInt());
			int len = t.size();
			int[] a = new int[len];
			for (int i = 0; i < len; i++)
				a[i] = t.pollLast();
			int count = 1;
			for (int i = 1; i < len; i++) {
				if (a[i] - r <= 0)
					break;
				count++;
				r += r1;
			}
			out.println(count);
			t.clear();
			a = null;
		}
		out.close();
	}
}


import java.util.Scanner;
import java.util.TreeSet;

public class CF1238B {
	static Scanner input = new Scanner(System.in);
	static int n, r, x, y;

	public static void main(String[] args) {
		int q = input.nextInt();
		for (int ii = 0; ii < q; ++ii) {
			TreeSet<Integer> t = new TreeSet<Integer>();
			n = input.nextInt();
			r = input.nextInt();
			for (int i = 0; i < n; i++)
				t.add(input.nextInt());
			int len = t.size();
			int[] a = new int[len];
			for (int i = 0; i < len; i++)
				a[i] = t.pollLast();
			int count = 1;
			for (int i = 1; i < len; i++) {
				if (a[i] - r <= 0)
					break;
				count++;
				r += i;
			}
			System.out.println(count);
			t.clear();
			a = null;
		}
	}
}


import java.util.Scanner;
import java.util.TreeSet;

public class CF1238B {
	static Scanner input = new Scanner(System.in);
	static int n, r, x, y;

	public static void main(String[] args) {
		int q = input.nextInt();
		for (int ii = 0; ii < q; ++ii) {
			TreeSet<Integer> t = new TreeSet<>();
			n = input.nextInt();
			r = input.nextInt();
			int r1 = r;
			for (int i = 0; i < n; i++)
				t.add(input.nextInt());
			int len = t.size();
			int[] a = new int[len];
			for (int i = 0; i < len; i++)
				a[i] = t.pollLast();
			int count = 1;
			for (int i = 1; i < len; i++) {
				if (a[i] - r <= 0)
					break;
				count++;
				r += r1;
			}
			System.out.println(count);
			t.clear();
			a = null;
		}
	}
}


import java.util.Scanner;
import java.util.TreeSet;

public class CF1238B {
	static Scanner input = new Scanner(System.in);
	static int n, r, x, y;

	public static void main(String[] args) {
		int q = input.nextInt();
		for (int ii = 0; ii < q; ++ii) {
			TreeSet<Integer> t = new TreeSet<Integer>();
			n = input.nextInt();
			r = input.nextInt();
			for (int i = 0; i < n; i++)
				t.add(input.nextInt());
			int[] a = new int[t.size()];
			for (int i = 0; i < t.size(); i++)
				a[i] = t.pollLast();
			int count = 1;
			for (int i = 1; i < n; i++) {
				if (a[i] - r <= 0)
					break;
				count++;
				r += i;
			}
			System.out.println(count);
			t.clear();
			a = null;
		}
	}
}


import java.util.Scanner;
import java.util.TreeSet;

public class CF1238B {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n, r, x, y;
		int q = input.nextInt();
		for (int ii = 0; ii < q; ++ii) {
			TreeSet<Integer> t = new TreeSet<>();
			n = input.nextInt();
			r = input.nextInt();
			int r1 = r;
			for (int i = 0; i < n; i++)
				t.add(input.nextInt());
			int len = t.size();
			int[] a = new int[len];
			for (int i = 0; i < len; i++)
				a[i] = t.pollLast();
			int count = 1;
			for (int i = 1; i < len; i++) {
				if (a[i] - r <= 0)
					break;
				count++;
				r += r1;
			}
			System.out.println(count);
			t.clear();
			a = null;
		}
	}
}


import java.util.Scanner;
import java.util.TreeSet;

public class CF1238B {
	static Scanner input = new Scanner(System.in);
	static int n, r, x, y;

	public static void main(String[] args) {
		int q = input.nextInt();
		for (int ii = 0; ii < q; ++ii) {
			TreeSet<Integer> t = new TreeSet<Integer>();
			n = input.nextInt();
			r = input.nextInt();
			for (int i = 0; i < n; i++)
				t.add(input.nextInt());
			int[] a = new int[t.size()];
			for (int i = 0; i < t.size(); i++)
				a[i] = t.pollLast();
			int count = 1;
			for (int i = 1; i < t.size(); i++) {
				if (a[i] - r <= 0)
					break;
				count++;
				r += i;
			}
			System.out.println(count);
			t.clear();
			a = null;
		}
	}
}


import java.io.*;
import java.util.*;

public class BRapido{

	static InputReader in = new InputReader(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	static int oo = (int)1e9;
	static int mod = 1_000_000_007;

	static int[] di = {1, 0, 0, -1};
	static int[] dj = {0, -1, 1, 0};

	public static void main(String[] args) throws IOException {

		int t = in.nextInt();
		while(t --> 0) {
			int n = in.nextInt();
			int r = in.nextInt();
			int[] a = in.nextIntArray(n);
			shuffle(a);
			Arrays.sort(a);
			int i = n-1;
			int ans = 0;
			int push = 0;
			while(i >= 0 && a[i] - push > 0) {
				ans++;
				int j = i;
				while(j >= 0 && a[j] == a[i])
					j--;
				if(j < 0)
					break;
				push += r;
				i = j;
			}
			System.out.println(ans);
		}

		out.close();
	}

	static int incr(int[] arr, int n, int i, int k, int prev, int max) {
		int num = prev + 1;
		while(i < n && k > 0) {
			if(num > max)
				return -1;
			arr[i] = num;
			i++; num++; k--;
		}
		return k == 0 ? i : -1;
	}

	static int mult(int[] arr, int n, int i, int k, int prev, int max) {
		int num = prev * 2;
		while(i < n && k > 0) {
			if(num > max)
				return -1;
			arr[i] = num;
			i++; num *= 2; k--;
		}
		return k == 0 ? i : -1;
	}

	static boolean inside(int i, int j, int n, int m) {
		return i >= 0 && i < n && j >= 0 && j < m;
	}

	static long pow(long a, long n, long mod) {
		if(n == 0)
			return 1;
		if(n % 2 == 1)
			return a * pow(a, n-1, mod) % mod;
		long x = pow(a, n / 2, mod);
		return x * x % mod;
	}

	static class SegmentTree {
		int n;
		char[] a;
		int[] seg;
		int DEFAULT_VALUE = 0;

		public SegmentTree(char[] a, int n) {
			super();
			this.a = a;
			this.n = n;
			seg = new int[n * 4 + 1];
			build(1, 0, n-1);
		}

		private int build(int node, int i, int j) {
			if(i == j) {
				int x = a[i] - 'a';
				return seg[node] = (1<<x);
			}
			int first = build(node * 2, i, (i+j) / 2);
			int second = build(node * 2 + 1, (i+j) / 2 + 1, j);
			return seg[node] = combine(first, second);
		}

		int update(int k, char value) {
			return update(1, 0, n-1, k, value);
		}

		private int update(int node, int i, int j, int k, char value) {
			if(k < i || k > j)
				return seg[node];
			if(i == j && j == k) {
				a[k] = value;
				int x = a[i] - 'a';
				return seg[node] = (1<<x);
			}
			int m = (i + j) / 2;
			int first = update(node * 2, i, m, k, value);
			int second = update(node * 2 + 1, m + 1, j, k, value);
			return seg[node] = combine(first, second);
		}

		int query(int l, int r) {
			return query(1, 0, n-1, l, r);
		}

		private int query(int node, int i, int j, int l, int r) {
			if(l <= i && j <= r)
				return seg[node];
			if(j < l || i > r)
				return DEFAULT_VALUE;
			int m = (i + j) / 2;
			int first = query(node * 2, i, m, l, r);
			int second = query(node * 2 + 1, m+1, j, l, r);
			return combine(first, second);
		}

		private int combine(int a, int b) {
			return a | b;
		}
	}

	static class DisjointSet {
		int n;
		int[] g;
		int[] h;
		public DisjointSet(int n) {
			super();
			this.n = n;
			g = new int[n];
			h = new int[n];
			for(int i = 0; i < n; ++i) {
				g[i] = i;
				h[i] = 1;
			}
		}
		int find(int x) {
			if(g[x] == x)
				return x;
			return g[x] = find(g[x]);
		}
		void union(int x, int y) {
			x = find(x); y = find(y);
			if(x == y)
				return;
			if(h[x] >= h[y]) {
				g[y] = x;
				if(h[x] == h[y])
					h[x]++;
			}
			else {
				g[x] = y;
			}
		}
	}

	static int[] getPi(char[] a) {
		int m = a.length;
		int j = 0;
		int[] pi = new int[m];
		for(int i = 1; i < m; ++i) {
			while(j > 0 && a[i] != a[j])
				j = pi[j-1];
			if(a[i] == a[j]) {
				pi[i] = j + 1;
				j++;
			}
		}
		return pi;
	}

	static long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}

	static boolean nextPermutation(int[] a) {
		for(int i = a.length - 2; i >= 0; --i) {
			if(a[i] < a[i+1]) {
				for(int j = a.length - 1; ; --j) {
					if(a[i] < a[j]) {
						int t = a[i];
						a[i] = a[j];
						a[j] = t;
						for(i++, j = a.length - 1; i < j; ++i, --j) {
							t = a[i];
							a[i] = a[j];
							a[j] = t;
						}
						return true;
					}
				}
			}
		}
		return false;
	}

	static void shuffle(int[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			int t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static void shuffle(long[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			long t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static int lower_bound(int[] a, int n, int k) {
		int s = 0;
		int e = n;
		int m;
		while (e - s > 0) {
			m = (s + e) / 2;
			if (a[m] < k)
				s = m + 1;
			else
				e = m;
		}
		return e;
	}
	static int lower_bound(long[] a, int n, long k) {
		int s = 0;
		int e = n;
		int m;
		while (e - s > 0) {
			m = (s + e) / 2;
			if (a[m] < k)
				s = m + 1;
			else
				e = m;
		}
		return e;
	}

	static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	static class Pair implements Comparable<Pair> {
		int first, second;

		public Pair(int first, int second) {
			super();
			this.first = first;
			this.second = second;
		}

		@Override
		public int compareTo(Pair o) {
			return this.first != o.first ? this.first - o.first : this.second - o.second;
		}

//		@Override
//		public int compareTo(Pair o) {
//			return this.first != o.first ? o.first - this.first : o.second - this.second;
//		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + first;
			result = prime * result + second;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Pair other = (Pair) obj;
			if (first != other.first)
				return false;
			if (second != other.second)
				return false;
			return true;
		}
	}
}

class InputReader {

	private final InputStream stream;
	private final byte[] buf = new byte[8192];
	private int curChar, snumChars;

	public InputReader(InputStream st) {
		this.stream = st;
	}

	public int read() {
		if (snumChars == -1)
			throw new InputMismatchException();
		if (curChar >= snumChars) {
			curChar = 0;
			try {
				snumChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (snumChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int nextInt() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

}


import java.io.*;
import java.math.*;
import java.util.*;

public class A_primeSubtraction {
    public static void main(String[] args) throws IOException {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);

        int n = sc.nextInt();
        while (n-->0) {
        	long x = sc.nextLong();
        	long y = sc.nextLong();
        	if (x == y+1) {
        		pw.println("NO");
        	}
        	else pw.println("YES");
        }

        pw.close();
    }
    static class FastScanner {
    	private boolean finished = false;

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw   new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
        public int peek() {
            if (numChars == -1) {
                return -1;
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private String readLine0() {
            StringBuilder buf = new StringBuilder();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r') {
                    buf.appendCodePoint(c);
                }
                c = read();
            }
            return buf.toString();
        }
        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0) {
                s = readLine0();
            }
            return s;
        }
        public String readLine(boolean ignoreEmptyLines) {
            if (ignoreEmptyLines) {
                return readLine();
            } else {
                return readLine0();
            }
        }

        public BigInteger readBigInteger() {
            try {
                return new BigInteger(nextString());
            } catch (NumberFormatException e) {
                throw new InputMismatchException();
            }
        }

        public char nextCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, nextInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean isExhausted() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1) {
                read();
            }
            return value == -1;
        }
    public String next() {
            return nextString();
        }

        public SpaceCharFilter getFilter() {
            return filter;
        }

        public void setFilter(SpaceCharFilter filter) {
            this.filter = filter;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
        public int[] nextIntArray(int n){
            int[] array=new int[n];
            for(int i=0;i<n;++i)array[i]=nextInt();
            return array;
        }
        public int[] nextSortedIntArray(int n){
            int array[]=nextIntArray(n);
            PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
            for(int i = 0; i < n; i++){
                pq.add(array[i]);
            }
            int[] out = new int[n];
            for(int i = 0; i < n; i++){
                out[i] = pq.poll();
            }
            return out;
        }
        public int[] nextSumIntArray(int n){
            int[] array=new int[n];
            array[0]=nextInt();
            for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
            return array;
        }
        public ArrayList<Integer>[] nextGraph(int n, int m){
            ArrayList<Integer>[] adj = new ArrayList[n];
            for(int i = 0; i < n; i++){
                adj[i] = new ArrayList<Integer>();
            }
            for(int i = 0; i < m; i++){
                int u = nextInt(); int v = nextInt();
                u--; v--;
                adj[u].add(v); adj[v].add(u);
            }
            return adj;
        }
        public ArrayList<Integer>[] nextTree(int n){
            return nextGraph(n, n-1);
        }

        public long[] nextLongArray(int n){
            long[] array=new long[n];
            for(int i=0;i<n;++i)array[i]=nextLong();
            return array;
        }
        public long[] nextSumLongArray(int n){
            long[] array=new long[n];
            array[0]=nextInt();
            for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
            return array;
        }
        public long[] nextSortedLongArray(int n){
            long array[]=nextLongArray(n);
            Arrays.sort(array);
            return array;
        }
    }
	static void shuffle(int[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			int temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}
	static void shuffle(long[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			long temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;

public class A_primeSubtraction {
    public static void main(String[] args) throws IOException {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);

        int n = sc.nextInt();
        while (n-->0) {
        	long x = sc.nextLong();
        	long y = sc.nextLong();
        	if (x == y+1) {
        		pw.println("NO");
        	}
        	else pw.println("YES");
        }

        pw.close();
    }
    static class FastScanner {
    	private boolean finished = false;

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw   new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException( );
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
        public int peek() {
            if (numChars == -1) {
                return -1;
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private String readLine0() {
            StringBuilder buf = new StringBuilder();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r') {
                    buf.appendCodePoint(c);
                }
                c = read();
            }
            return buf.toString();
        }
        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0) {
                s = readLine0();
            }
            return s;
        }
        public String readLine(boolean ignoreEmptyLines) {
            if (ignoreEmptyLines) {
                return readLine();
            } else {
                return readLine0();
            }
        }

        public BigInteger readBigInteger() {
            try {
                return new BigInteger(nextString());
            } catch (NumberFormatException e) {
                throw new InputMismatchException();
            }
        }

        public char nextCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, nextInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean isExhausted() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1) {
                read();
            }
            return value == -1;
        }
    public String next() {
            return nextString();
        }

        public SpaceCharFilter getFilter() {
            return filter;
        }

        public void setFilter(SpaceCharFilter filter) {
            this.filter = filter;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
        public int[] nextIntArray(int n){
            int[] array=new int[n];
            for(int i=0;i<n;++i)array[i]=nextInt();
            return array;
        }
        public int[] nextSortedIntArray(int n){
            int array[]=nextIntArray(n);
            PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
            for(int i = 0; i < n; i++){
                pq.add(array[i]);
            }
            int[] out = new int[n];
            for(int i = 0; i < n; i++){
                out[i] = pq.poll();
            }
            return out;
        }
        public int[] nextSumIntArray(int n){
            int[] array=new int[n];
            array[0]=nextInt();
            for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
            return array;
        }
        public ArrayList<Integer>[] nextGraph(int n, int m){
            ArrayList<Integer>[] adj = new ArrayList[n];
            for(int i = 0; i < n; i++){
                adj[i] = new ArrayList<Integer>();
            }
            for(int i = 0; i < m; i++){
                int u = nextInt(); int v = nextInt();
                u--; v--;
                adj[u].add(v); adj[v].add(u);
            }
            return adj;
        }
        public ArrayList<Integer>[] nextTree(int n){
            return nextGraph(n, n-1);
        }

        public long[] nextLongArray(int n){
            long[] array=new long[n];
            for(int i=0;i<n;++i)array[i]=nextLong();
            return array;
        }
        public long[] nextSumLongArray(int n){
            long[] array=new long[n];
            array[0]=nextInt();
            for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
            return array;
        }
        public long[] nextSortedLongArray(int n){
            long array[]=nextLongArray(n);
            Arrays.sort(array);
            return array;
        }
    }
	static void shuffle(int[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			int temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}
	static void shuffle(long[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			long temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}
}


import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();

            PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < n; i++) {
                int x = Integer.parseInt(sc.next());
                if (set.add(x)) {
                    pq.offer(x);
                }
            }

            int offset = 0;
            int ans = 0;
            while (!pq.isEmpty()) {
                if (pq.poll()-offset > 0) {
                    ans++;
                    offset += r;
                } else {
                    break;
                }
            }

            System.out.println(ans);
        }
    }

    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = sc.nextInt();
            }
            Arrays.sort(x);

            int offset = 0;
            int ans = 0;
            int pos = n-1;
            while (pos >= 0 && x[pos]-offset > 0) {
                ans++;
                offset += r;
                int target = x[pos];
                while (pos >= 0 && x[pos] == target) {
                    pos--;
                }
            }

            System.out.println(ans);
        }
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = sc.nextInt();
            }
            Arrays.sort(x);

            int offset = 0;
            int ans = 0;
            int pos = n-1;
            while (pos > 0 && x[pos]-offset > 0) {
                ans++;
                offset += r;
                int target = x[pos];
                if (x[pos]-offset > 0) {
                    while (pos > 0 && x[pos] == target) {
                        pos--;
                    }
                } else {
                    break;
                }
            }

            System.out.println(ans);
        }
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();

            List<Integer> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(sc.nextInt());
            }
            Collections.shuffle(list);

            int[] x = new int[n];
            int i = 0;
            for (int xx:list) {
                x[i++] = xx;
            }
            Arrays.sort(x);

            int offset = 0;
            int ans = 0;
            int pos = n-1;
            while (pos >= 0 && x[pos]-offset > 0) {
                ans++;
                offset += r;
                int target = x[pos];
                while (pos >= 0 && x[pos] == target) {
                    pos--;
                }
            }

            System.out.println(ans);
        }
    }
}


import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();

            PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt();
                if (set.add(x)) {
                    pq.offer(x);
                }
            }

            int offset = 0;
            int ans = 0;
            while (!pq.isEmpty()) {
                if (pq.poll()-offset > 0) {
                    ans++;
                    offset += r;
                } else {
                    break;
                }
            }

            System.out.println(ans);
        }
    }

    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();

            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < n; i++) {
                set.add(sc.nextInt());
            }

            int[] x = new int[n];
            int i = 0;
            for (int xx:set) {
                x[i++] = xx;
            }
            Arrays.sort(x);

            int offset = 0;
            int ans = 0;
            int pos = n-1;
            while (pos >= 0 && x[pos]-offset > 0) {
                ans++;
                offset += r;
                pos--;
            }

            System.out.println(ans);
        }
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = sc.nextInt();
            }
            Arrays.sort(x);

            int offset = 0;
            int ans = 0;
            int pos = n-1;
            while (pos >= 0 && x[pos]-offset > 0) {
                ans++;
                offset += r;
                int target = x[pos];
                if (x[pos]-offset > 0) {
                    while (pos > 0 && x[pos] == target) {
                        pos--;
                    }
                } else {
                    break;
                }
            }

            System.out.println(ans);
        }
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();

            PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());
            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < n; i++) {
                int x = Integer.parseInt(sc.next());
                if (set.add(x)) {
                    pq.offer(x);
                }
            }

            int offset = 0;
            int ans = 0;
            while (!pq.isEmpty()) {
                if (pq.poll()-offset > 0) {
                    ans++;
                    offset += r;
                } else {
                    break;
                }
            }

            System.out.println(ans);
        }
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();

            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < n; i++) {
                set.add(Integer.parseInt(sc.next()));
            }

            int[] x = new int[set.size()];
            int i = 0;
            for (int xx:set) {
                x[i++] = xx;
            }
            Arrays.sort(x);

            int offset = 0;
            int ans = 0;
            int pos = set.size()-1;
            while (pos >= 0 && x[pos]-offset > 0) {
                ans++;
                offset += r;
                pos--;
            }

            System.out.println(ans);
        }
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        for (int t = 0; t < q; t++) {
            int n = sc.nextInt();
            int r = sc.nextInt();

            Set<Integer> set = new HashSet<>();
            for (int i = 0; i < n; i++) {
                set.add(Integer.parseInt(sc.next()));
            }

            int[] x = new int[n];
            int i = 0;
            for (int xx:set) {
                x[i++] = xx;
            }
            Arrays.sort(x);

            int offset = 0;
            int ans = 0;
            int pos = n-1;
            while (pos >= 0 && x[pos]-offset > 0) {
                ans++;
                offset += r;
                pos--;
            }

            System.out.println(ans);
        }
    }
}


import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.TreeSet;

public class B1238KillEmAll {

    public static void main(String[] args) throws IOException
    {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        int t = Integer.parseInt(in.readLine());
        while (t-- != 0) {
            String[] s = in.readLine().split(" ");
            int n = Integer.parseInt(s[0]);
            int r = Integer.parseInt(s[1]);
            s = in.readLine().split(" ");
            int[] ar = new int[n];

            for (int i = 0; i < n; i++) {
                ar[i] = Integer.parseInt(s[i]);
            }

            out.write(sol(n,r,ar) + "\n");
        }
        out.flush();
    }

    private static int sol(int n, int r, int[] ar) {

        Arrays.sort(ar);
        int count = 0;
        TreeSet<Integer> set = new TreeSet<>();

        for (int i = 0; i < n; i++) {
            set.add(ar[i]);
        }

        ArrayList<Integer> res = new ArrayList<>(set);

        for (int i = res.size() - 1; i >= 0; i--) {
            if (res.get(i) - count * r <= 0) break;
            count++;
        }
        return count;

    }

}


import java.io.*;
import java.util.ArrayList;
import java.util.Set;
import java.util.TreeMap;

public class _Rough{
        public static void main(String[] args) throws IOException {

            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
            int t = Integer.parseInt(in.readLine());
            while (t-- > 0) {
                String[] s = in.readLine().split(" ");
                int n = Integer.parseInt(s[0]);
                int r = Integer.parseInt(s[1]);

                s = in.readLine().split(" ");
                int[] ar = new int[n];

                for (int i = 0; i < n; i++) {
                    ar[i] = Integer.parseInt(s[i]);
                }

                TreeMap<Integer, Integer> map = new TreeMap<>();
                for (int i = 0; i < n; i++) {
                    map.put(ar[i], 1);
                }
                Set<Integer> list1 = map.keySet();
                ArrayList<Integer> newlist = new ArrayList<>();
                for (int i : list1) {
                    newlist.add(i);
                }
                int mul = 0;
                int ans = 0;
                for (int i = newlist.size() - 1; i >= 0; i--) {
                    int curr = newlist.get(i);
                    curr -= (mul * r);
                    mul++;
                    if (curr <= 0) {
                        break;
                    } else {
                        ans++;
                    }
                }
                out.write(ans + "\n");
            }
            out.flush();
        }
        }


import java.io.*;
import java.util.*;

public class B1238KillEmAll {

    public static void main(String[] args) throws IOException
    {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        int t = Integer.parseInt(in.readLine());
        while (t-- != 0) {
            String[] s = in.readLine().split(" ");
            int n = Integer.parseInt(s[0]);
            int r = Integer.parseInt(s[1]);
            s = in.readLine().split(" ");
            int[] ar = new int[n];

            for (int i = 0; i < n; i++) {
                ar[i] = Integer.parseInt(s[i]);
            }

            out.write(sol(n,r,ar) + "\n");
        }
        out.flush();
    }

    private static int sol(int n, int r, int[] ar) {

        Arrays.sort(ar);
        int count = 0;
        TreeMap<Integer, Integer> map = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ar[i], 1);
        }

        ArrayList<Integer> res = new ArrayList<>(map.keySet());

        for (int i = res.size() - 1; i >= 0; i--) {
            if (res.get(i) - count * r <= 0) break;
            count++;
        }
        return count;

    }

//        for (int i = 0; i < set.size(); i++) {
//
//    }

}


import java.io.*;
import java.util.ArrayList;
import java.util.Set;
import java.util.TreeMap;

public class _Rough{
        public static void main(String[] args) throws IOException {

            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
            int t = Integer.parseInt(in.readLine());
            while (t-- > 0) {
                String[] s = in.readLine().split(" ");
                int n = Integer.parseInt(s[0]);
                int r = Integer.parseInt(s[1]);

                s = in.readLine().split(" ");
                int[] ar = new int[n];

                for (int i = 0; i < n; i++) {
                    ar[i] = Integer.parseInt(s[i]);
                }

                TreeMap<Integer, Integer> map = new TreeMap<>();
                for (int i = 0; i < n; i++) {
                    map.put(ar[i], 1);
                }
                Set<Integer> list1 = map.keySet();
                ArrayList<Integer> newlist = new ArrayList<>(list1);

                int mul = 0;
                int ans = 0;
                for (int i = newlist.size() - 1; i >= 0; i--) {
                    int curr = newlist.get(i);
                    curr -= (mul * r);
                    mul++;
                    if (curr <= 0) {
                        break;
                    } else {
                        ans++;
                    }
                }
                out.write(ans + "\n");
            }
            out.flush();
        }
        }


import java.io.*;
import java.util.*;

public class B1238KillEmAll {

    public static void main(String[] args) throws IOException
    {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        int t = Integer.parseInt(in.readLine());
        while (t-- != 0) {
            String[] s = in.readLine().split(" ");
            int n = Integer.parseInt(s[0]);
            int r = Integer.parseInt(s[1]);
            s = in.readLine().split(" ");
            int[] ar = new int[n];

            for (int i = 0; i < n; i++) {
                ar[i] = Integer.parseInt(s[i]);
            }

            out.write(sol(n,r,ar) + "\n");
        }
        out.flush();
    }

    private static int sol(int n, int r, int[] ar) {

        Arrays.sort(ar);
        int count = 0;
        TreeMap<Integer, Integer> map = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ar[i], 1);
        }

        Set<Integer> list = map.keySet();
//        ArrayList<Integer> res = new ArrayList<>(map.keySet());
        ArrayList<Integer> res = new ArrayList<>();
        for (int i : list) {
            res.add(i);
        }

        for (int i = res.size() - 1; i >= 0; i--) {
            if (res.get(i) - count * r <= 0) break;
            count++;
        }
        return count;

    }

//        for (int i = 0; i < set.size(); i++) {
//
//    }

}


import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.TreeSet;

public class B1238KillEmAll {

    public static void main(String[] args) throws IOException
    {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        int t = Integer.parseInt(in.readLine());
        while (t-- != 0) {
            String[] s = in.readLine().split(" ");
            int n = Integer.parseInt(s[0]);
            int r = Integer.parseInt(s[1]);
            s = in.readLine().split(" ");
            int[] ar = new int[n];

            for (int i = 0; i < n; i++) {
                ar[i] = Integer.parseInt(s[i]);
            }

            out.write(sol(n,r,ar) + "\n");
        }
        out.flush();
    }

    private static int sol(int n, int r, int[] ar) {

        Arrays.sort(ar);
        int count = 0;
        TreeSet<Integer> set = new TreeSet<>();

        for (int i = 0; i < n; i++) {
            set.add(ar[i]);
        }

        ArrayList<Integer> res = new ArrayList<>(set);

        int mul = 0;

        for (int i = res.size() - 1; i >= 0; i--) {
            int curr = res.get(i);
            curr -= (mul * r);
            mul++;
            if (curr <= 0) {
                break;
            } else {
                count++;
            }
        }

//        for (int i = res.size() - 1; i >= 0; i--) {
//            if (res.get(i) - count * r <= 0) break;
//            count++;
//        }
        return count;

    }

//        for (int i = 0; i < set.size(); i++) {
//
//    }

}


import java.io.*;
import java.util.ArrayList;
import java.util.TreeSet;

public class B1238KillEmAll {

    public static void main(String[] args) throws IOException
    {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        int t = Integer.parseInt(in.readLine());
        while (t-- != 0) {
            String[] s = in.readLine().split(" ");
            int n = Integer.parseInt(s[0]);
            int r = Integer.parseInt(s[1]);
            s = in.readLine().split(" ");
            int[] ar = new int[n];

            for (int i = 0; i < n; i++) {
                ar[i] = Integer.parseInt(s[i]);
            }

            out.write(sol(n,r,ar) + "\n");
        }
        out.flush();
    }

    private static int sol(int n, int r, int[] ar) {

//        Arrays.sort(ar);
        int count = 0;
        TreeSet<Integer> set = new TreeSet<>();

        for (int i = 0; i < n; i++) {
            set.add(ar[i]);
        }

        ArrayList<Integer> res = new ArrayList<>(set);

        for (int i = res.size() - 1; i >= 0; i--) {
            if (res.get(i) - count * r <= 0) break;
            count++;
        }
        return count;

    }

}


import java.io.*;
import java.util.*;

public class B1238KillEmAll {

    public static void main(String[] args) throws IOException
    {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        int t = Integer.parseInt(in.readLine());
        while (t-- != 0) {
            String[] s = in.readLine().split(" ");
            int n = Integer.parseInt(s[0]);
            int r = Integer.parseInt(s[1]);
            s = in.readLine().split(" ");
            int[] ar = new int[n];

            for (int i = 0; i < n; i++) {
                ar[i] = Integer.parseInt(s[i]);
            }

            out.write(sol(n,r,ar) + "\n");
        }
        out.flush();
    }

    private static int sol(int n, int r, int[] ar) {

        Arrays.sort(ar);
        int count = 0;
        TreeMap<Integer, Integer> map = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            map.put(ar[i], 1);
        }

        Set<Integer> list = map.keySet();
//        ArrayList<Integer> res = new ArrayList<>(map.keySet());
        ArrayList<Integer> res = new ArrayList<>();
        for (int i : list) {
            res.add(i);
        }

        int mul = 0;
        for (int i = res.size() - 1; i >= 0; i--) {
            int curr = res.get(i);
            curr -= (mul * r);
            mul++;
            if (curr <= 0) {
                break;
            } else {
                count++;
            }
        }

//        for (int i = res.size() - 1; i >= 0; i--) {
//            if (res.get(i) - count * r <= 0) break;
//            count++;
//        }
        return count;

    }

}


import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main{
    static int MAX=100001;
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int Q=sc.nextInt();
        while(Q-->0){
            int n=sc.nextInt(),r=sc.nextInt(),ind=0;
            int[] x=new int[MAX];
            for(int i=0;i<n;i++){
                int a=sc.nextInt();
                ind=Math.max(a,ind);
                x[a]++;
            }
            int o=0;
            int en=0,ans=0;
            while(o<ind && en<n){
                en+=x[ind];
                ind--;
                while(ind>=0 && x[ind]==0){
                    ind--;
                }
                ans++;
                o+=r;
            }
            System.out.println(ans);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;

public class MSNG{
    public static void main(String[] args){
        FastReader sc=new FastReader();
        int q=sc.nextInt();
        while(q-->0){
            int n=sc.nextInt(),r=sc.nextInt();
            int v,max=0;
            ArrayList<Integer> arrL=new ArrayList<Integer>();
            for(int i=0;i<n;i++){
                v=sc.nextInt();
                arrL.add(v);
            }
            Collections.sort(arrL);int ans=0;
            for(int i=1;i<arrL.size();i++) {
            	if(arrL.get(i)==arrL.get(i-1)) {arrL.remove(i-1);i--;}
            }
            for (int i=arrL.size()-1;i>=0;i--)
        		if(arrL.get(i)-ans*r>0) ans +=1;
            System.out.println(ans);
        }
    }
}

class FastReader{
    BufferedReader bf;
    StringTokenizer st;
    FastReader(){
        bf=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next(){
        if(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(bf.readLine());
            }catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public long nextLong(){
        return Long.parseLong(next());
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        FastReader sc=new FastReader();
        PrintWriter pw=new PrintWriter(System.out);
        int T=sc.nextInt();
        while(T-->0){
            int n=sc.nextInt(),r=sc.nextInt();
            TreeSet<Integer> tree=new TreeSet<Integer>();
            for(int i=0;i<n;i++) {
            	tree.add(sc.nextInt());
            }
            int len=tree.size();
            int o=0;int ans=0;
//            System.out.println(tree);
            for(int i=0;i<len;i++) {
            	int tem=tree.pollLast();//System.out.println(tem);
            	if(tem-ans*r>0) ans++;
            }
            System.out.println(ans);
        }
    }
}

class FastReader{
    BufferedReader bf;
    StringTokenizer st;
    FastReader(){
        bf=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next(){
        if(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(bf.readLine());
            }catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public long nextLong(){
        return Long.parseLong(next());
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;

public class MSNG{
    public static void main(String[] args){
        FastReader sc=new FastReader();
        int q=sc.nextInt();
        while(q-->0){
            int n=sc.nextInt(),r=sc.nextInt();
            int v,max=0;
            ArrayList<Integer> arrL=new ArrayList<Integer>();
            for(int i=0;i<n;i++){
                v=sc.nextInt();
                if(!arrL.contains(v)){
                    arrL.add(v);
                }
                max=Math.max(v,max);
            }
            Collections.sort(arrL);int ans=0;
            for (int i=arrL.size()-1;i>=0;i--)
        		if(arrL.get(i)-ans*r>0) ans +=1;
            System.out.println(ans);
        }
    }
}

class FastReader{
    BufferedReader bf;
    StringTokenizer st;
    FastReader(){
        bf=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next(){
        if(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(bf.readLine());
            }catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public long nextLong(){
        return Long.parseLong(next());
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;

public class MSNG{
    public static void main(String[] args){
        FastReader sc=new FastReader();
        int q=sc.nextInt();
        while(q-->0){
            int n=sc.nextInt(),r=sc.nextInt();
            int v,max=0;
            ArrayList<Integer> arrL=new ArrayList<Integer>();
            for(int i=0;i<n;i++){
                v=sc.nextInt();
                arrL.add(v);
            }
            Collections.sort(arrL);int ans=0;
            for(int i=1;i<arrL.size();i++) {
            	if(arrL.get(i)==arrL.get(i-1))arrL.remove(i);
            }
            for (int i=arrL.size()-1;i>=0;i--)
        		if(arrL.get(i)-ans*r>0) ans +=1;
            System.out.println(ans);
        }
    }
}

class FastReader{
    BufferedReader bf;
    StringTokenizer st;
    FastReader(){
        bf=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next(){
        if(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(bf.readLine());
            }catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public long nextLong(){
        return Long.parseLong(next());
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;

public class MSNG{
    public static void main(String[] args){
        FastReader sc=new FastReader();
        int q=sc.nextInt();
        while(q-->0){
            int n=sc.nextInt(),r=sc.nextInt();
            int v,max=0;
            ArrayList<Integer> arrL=new ArrayList<Integer>();
            for(int i=0;i<n;i++){
                v=sc.nextInt();
                if(!arrL.contains(v)){
                    arrL.add(v);
                }
                max=Math.max(v,max);
            }
            Collections.sort(arrL);
            int o=0;
            int nd=max;int hatiyar=0;
            while(!arrL.isEmpty()){
            	ArrayList<Integer> remove=new ArrayList<Integer>();
                hatiyar++;
                o+=r;
                arrL.remove(arrL.size()-1);
                //System.out.println(arrL);
                Iterator<Integer> it=arrL.iterator();
                while(it.hasNext()){
                    int nx=it.next();
                    if(nx>o){
                        break;
                    }
                    else{
                        remove.add(nx);
                    }
                }
                arrL.removeAll(remove);
            }
            System.out.println(hatiyar);
        }
    }
}

class FastReader{
    BufferedReader bf;
    StringTokenizer st;
    FastReader(){
        bf=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next(){
        if(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(bf.readLine());
            }catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public long nextLong(){
        return Long.parseLong(next());
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        FastReader sc=new FastReader();
        int q=sc.nextInt();
        while(q-->0){
            int n=sc.nextInt(),r=sc.nextInt();
            int[] a=new int[n];
            int i=0;
            while(i<n){
                a[i]=sc.nextInt();
                i++;
            }
            Arrays.sort(a);
            ArrayList<Integer> arrL=new ArrayList<Integer>();
            int temp=-1;
            i=0;
            while(i<n){
                if(temp==-1 || temp!=a[i]) {
                    arrL.add(a[i]);
                    temp=a[i];
                }
                i++;
            }
            int ans=0;
            for (i=arrL.size()-1;i>=0;i--)
        		if(arrL.get(i)-ans*r>0) ans +=1;
        	System.out.println(ans);
        }

    }
}

class FastReader{
    BufferedReader bf;
    StringTokenizer st;
    FastReader(){
        bf=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next(){
        if(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(bf.readLine());
            }catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public long nextLong(){
        return Long.parseLong(next());
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Scanner;
import java.util.StringTokenizer;

public class MSNG{
    public static void main(String[] args){
        FastReader sc=new FastReader();
        int q=sc.nextInt();
        while(q-->0){
            int n=sc.nextInt(),r=sc.nextInt();
            int v,max=0;
            ArrayList<Integer> arrL=new ArrayList<Integer>();
            for(int i=0;i<n;i++){
                v=sc.nextInt();
                if(!arrL.contains(v)){
                    arrL.add(v);
                }
                max=Math.max(v,max);
            }
            Collections.sort(arrL);
            int o=0;
            int nd=max;int hatiyar=0;
            while(!arrL.isEmpty()){
                hatiyar++;
                o+=r;
                arrL.remove(arrL.size()-1);
                while(arrL.size()>0 && arrL.get(0)<=o) {
                	arrL.remove(0);
                }
            }
            System.out.println(hatiyar);
        }
    }
}

class FastReader{
    BufferedReader bf;
    StringTokenizer st;
    FastReader(){
        bf=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next(){
        if(st==null || !st.hasMoreElements()){
            try{
                st=new StringTokenizer(bf.readLine());
            }catch(IOException e){
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    public long nextLong(){
        return Long.parseLong(next());
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.util.Random;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author El-Bishoy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Div2B1238_killEmAll_t_distances_on_line solver = new Div2B1238_killEmAll_t_distances_on_line();
        solver.solve(1, in, out);
        out.close();
    }

    static class Div2B1238_killEmAll_t_distances_on_line {
        public void solve(int testNumber, InputReader in, OutputWriter out) {

            int q = in.nextInt();
            StringBuilder stringBuilder = new StringBuilder();
            while (q-- > 0) {

                int n = in.nextInt();
                int d = in.nextInt();
                int[] arr = in.nextIntArray(n);
                ArrayUtils.shuffle(arr);
                Arrays.sort(arr);

                int ans = 0;
                int acc = 0;
                int prev = -1;
                for (int i = n - 1; i >= 0; i--) {

                    if (arr[i] - acc > 0 && arr[i] != prev) {
                        ans++;
                        prev = arr[i];
                        acc += d;
                    }

                }

                stringBuilder.append(ans).append("\n");
            }

            out.println(stringBuilder);

        }

    }

    static class ArrayUtils {
        public static void shuffle(int[] c) {
            for (int i = 0; i < c.length; i++) {
                int x = (new Random().nextInt(c.length));
                int temp = c[x];
                c[x] = c[i];
                c[i] = temp;
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; ++i) array[i] = nextInt();
            return array;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author El-Bishoy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Div2B1238_killEmAll_t_distances_on_line solver = new Div2B1238_killEmAll_t_distances_on_line();
        solver.solve(1, in, out);
        out.close();
    }

    static class Div2B1238_killEmAll_t_distances_on_line {
        public void solve(int testNumber, InputReader in, OutputWriter out) {

            int q = in.nextInt();
            while (q-- > 0) {

                int n = in.nextInt();
                int d = in.nextInt();
                int[] arr = in.nextIntArray(n);
                Arrays.sort(arr);

                int ans = 0;
                int acc = 0;
                int prev = -1;
                for (int i = n - 1; i >= 0; i--) {

                    if (arr[i] - acc > 0 && arr[i] != prev) {
                        ans++;
                        prev = arr[i];
                    }
                    acc += d;
                }

                out.println(ans);
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; ++i) array[i] = nextInt();
            return array;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}