def dfs(i,ans):
  if i == n:
    return
  if len(ans) == 0:
    ans.append(a[i])
    dfs(i+1,ans)
  else:
    if abs(ans[-1]-a[i])<=k:
      ans.append(a[i])
    dfs(i+1,ans)

n,k = map(int,input().split())
ans = []
a = []
for i in range(n):
  a.append(int(input()))
#print(a)
mx = 0
for i in range(n):
  tmp = []
  dfs(i,tmp)
  mx = max(mx,len(tmp))
print(mx)