n,k=map(int,input().split())
l=[int(input())for i in range(n)]
t=[-1 for i in range(n)]
for i in range(n)[::-1]:
    j=i
    if t[i]==-1:
        e=1
        while i+1<n:
            if abs(l[i]-l[i+1])<=k:
                if t[i+1]!=-1:
                    e+=t[i+1]
                    break
                e+=1
            i+=1
        t[j]=e
print(max(t))
#print(*t)