N, K = map(int, input().split())
A = [int(input()) for n in range(N)]

B = [A[0]]
append = B.append

for a in A[1:]:
  if abs(a - B[-1]) > K:
    if a > B[-1]:
      append(B[-1] + K)
    else:
      append(B[-1] - K)
  else:
    if B[-1] != a:
      append(a)

print(len(B))