line= input().split(" ")
a=int(line[0])
b=int(line[1])
list_A=[]

for i in range(a):
    temp=int(input())
    list_A.append(temp)

list_B=[]
NGlist=[]
list_B.append(list_A[0])
for i in range(a-1):
    c=list_A[i]
    d=list_A[i+1]
    if(c>=d):
        if(c - d <= b):
            list_B.append(d)
        else:
            NGlist.append(i)
    else:
        if(d - c <= b):
            list_B.append(d)
        else:
            NGlist.append(i)
res=len(list_B)
#print(NGlist)

while(len(NGlist)>0)and(a-NGlist[0]>res):
    list_B=[]
    num=NGlist[0]
    for i in range(num,a-num-1):
        c=list_A[i]
        d=list_A[i+1]
        if(c>=d):
            if(c - d <= b):
                list_B.append(d)
                if(i in NGlist):
                    NGlist.remove(i)
        else:
            if(d - c <= b):
                list_B.append(d)
                if(i in NGlist):
                    NGlist.remove(i)
    
        if res<=len(list_B):
            res=len(list_B)
    #print(list_B)    
    NGlist.remove(num)
       
print(res)