n, k = map(int, input().split())
count = 0
for i in range(n):
  a = int(input())
  if i == 0:
    prev = a
  if abs(a - prev) <= k:
    if count == 0:
      if i != 0:
        count += 2
        prev = a
    else:
      prev = a
      count += 1
print(count)