h, w = map(int, input().split())
s = [int(input()) for _ in range(h)]

ans=[]

pointer=0

for i in range(1,len(s)):
  if abs(s[pointer] - s[i]) <=w:
    if pointer==0:
      ans.append(s[pointer])
      ans.append(s[i])
    else:
      ans.append(s[i])
    pointer=i

if h==1:
  print(0)
else:
  print(len(ans))