n,k=map(int,input().split())
a = [input() for i in range(n)]
b=[a[0]]
for i in a[1:]:
  if abs(int(b[-1])-int(i))<=k:
    b.append(i)


c=[a[1]]
for i in a[2:]:
  if abs(int(c[-1])-int(i))<=k:
    c.append(i)

print(max(len(b),len(c)))