n,k = map(int,input().split())
x = []
y = []
z = []
tmp = int(input())
x.append(tmp)
y.append(tmp)
for i in range(n-1):
  t = int(input())
  if abs(t-tmp) <= k:
    x.append(t)
    tmp = t
  y.append(t)
tmp = y[1]
z.append(tmp)
for i in range(2,n):
  t = y[i]
  if abs(t-tmp) <= k:
    z.append(t)
    tmp = t
print(max(len(x),len(z)))