n, k = map(int, input().split())

N = []
for i in range(n):
    N.append(int(input()))

# 隣同士がいくつ離れているかをカウント
dist = [0 for _ in range(n + 3)]
for i in range(1, n):
    dist[abs(N[i] - N[i - 1])] += 1

ans = 0

for i in range(k + 1):
    ans += dist[i]

# print(dist)
print(ans + 1)
