import sys
input = sys.stdin.readline
import math
############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
n,k=invr()
li=inlt()
li.sort()
tar=li[0]+k
cnt=0
for i in li:
    if i > tar:
        cnt+=1

print(cnt)