N,M=map(int, input().split()) X=list(map(int, input().split())) from collections import deque d=deque() for i in range(N): if i==0: d.append((X[i],1)) else: x=X[i] ma=1 while d and x-d[0][0]>=M: _,c=d.popleft() ma=max(ma,c+1) d.append((x,ma)) ans=0 while d: _,c=d.popleft() ans=max(ans,c) print(ans)