2 1
1 1
 4 1
2 2 1 1
 10 1
2 6 3 4 2 4 4 3 2 1
 2 1
999152 999153
 8 1000000
1 1 5 1000000 1000000 2 2 2
 9 2
1 6 1 5 5 8 6 8 7
 15 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 1 4
8
 10 1
6 3 1 3 6 4 1 3 6 4
 10 1
1 2 3 5 6 8 10 11 9 4
 7 2
1 5 5 8 9 8 8
 2 1000000
1 1000000
 8 2
3 13 9 8 3 13 9 14
 1 1
1
 2 1
1 2

2
 2
 4
 1
 2
 4
 15
 1
 7
 2
 4
 1
 5
 1
 1


import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class SecondServerClient {
	static String lastMessage = "";
	static String name1 = "";
	static int existFlag = 0;
	static Socket clientSocket = null;

	public static void main(String[] args) throws UnknownHostException, IOException {
	  Scanner sc= new Scanner(System.in);
	  int n =sc.nextInt(), k=sc.nextInt();
	
	  HashSet<Integer> hs = new HashSet<>();
	  HashMap<Integer, Integer> hm = new HashMap<>();
	  ArrayList<Integer> ar = new ArrayList<>();
	  for(int i=0;i<n;i++) {
		  int y =sc.nextInt();
		  if(hs.contains(y)) {
			   hm.put(y, hm.get(y)+1);
		   
		   }else {
			   ar.add(y);
			   hm.put(y, 1);
			   hs.add(y);
		   }
		    
	  }
	  
	  Collections.sort(ar);
	  
	  int take=0;
	  for(int i=0;i<ar.size()-1;i++) {
		  if(ar.get(i)+k>=ar.get(i+1)&&ar.get(i+1)>ar.get(i)) {
			  take+=hm.get(ar.get(i));
		  }
	  }
	  System.out.println(n-take);

	}

	static void Chat(String Source, String Destination, int TTL, String Message) throws IOException {
		DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
		outToServer.writeBytes("to " + Destination + " " + Message + " (from " + Source + ")" + TTL);
		clientSocket.close();
	}

	static boolean Join(String name) throws IOException {
		clientSocket = new Socket("localhost", 6005);
		DataOutputStream outToServer1 = new DataOutputStream(clientSocket.getOutputStream());
		outToServer1.writeBytes("log " + name + '\n');
		BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
		String serverResponse = inFromServer.readLine();
		if (serverResponse.equals("Registered")) {
			System.out.println(serverResponse);
			clientSocket.close();
			return true;
		}
		clientSocket.close();
		return false;
	}

	static void GetMemberList() throws UnknownHostException, IOException {

		String op = "GetMemberList";

		DataOutputStream outToServer1 = new DataOutputStream(clientSocket.getOutputStream());
		outToServer1.writeBytes("log " + op + '\n');

		BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
		String sit = inFromServer.readLine();

		System.out.println(sit);

	}

	public static class getMessage implements Runnable {
		private Thread t;
		private String threadName;

		getMessage(String name) {
			threadName = name;

		}

		public void run() {

			try {
				while (true) {

					if (existFlag == 1)
						return;

					Socket clientSocket = new Socket("localhost", 6005);

					DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
					outToServer.writeBytes("123" + name1 + '\n');
					BufferedReader inFromServer = new BufferedReader(
							new InputStreamReader(clientSocket.getInputStream()));

					String modifiedSentence = inFromServer.readLine();
					if (modifiedSentence != null && !modifiedSentence.equals(lastMessage)) {
						System.out.println(modifiedSentence);
						lastMessage = modifiedSentence;
					}
					clientSocket.close();

					Thread.sleep(1000);
				}
			} catch (InterruptedException e) {
				System.out.println("Thread " + threadName + " interrupted.");
			} catch (UnknownHostException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			System.out.println("Thread " + threadName + " exiting.");
		}

		public void start() {

			if (t == null) {
				t = new Thread(this, threadName);
				t.start();
			}
		}
	}
}