N,K = map(int,input().split())
List = []
for _ in range(N):
  a = int(input())
  List.append(a)
counter = 0
data = List[0]
for i in range(N):
  if data-K <= List[i] <= data +K:
    counter += 1
    data = List[i]
print(counter)