#d
n,k=map(int,input().split())
a=[]
for i in range(n):
    ai=int(input())
    a.append(ai)
ans=0
for i in range(2**n):
    f=0
    ansi=1
    for j in range(n):
        if ((i>>j) & 1):
            if f==1:
                if abs(g-a[j])<=k:
                    g=a[j]
                    ansi+=1
            else:
                g=a[j]
                f=1
    ans=max(ans,ansi)

print(ans)