n,d=map(int,input().split())
a=list(map(int,input().split()))
b=[0]*n
k=0
for i in range(n):
    for j in range(n):
        #print(abs(a[i]-a[j]))
        if abs(a[i]-a[j])>d:
            b[i]+=1
    if b[i]>(n/2) and n%2==1:
        k+=1
    if b[i]>(n/2)-1 and n%2==0:
        k+=1
print(k)
