n,k = map(int,input().split())
ls = [int(input()) for i in range(n)]
ans = 0
p = 0
for i in range(n):
    p += i
    for j in range(p+1,n):
        if abs(ls[p]-ls[j]) <= k:
            #print(p,j)
            ans += 1
            p = j-i-1
            break
print(ans)