N,T = list(map(int,input().split()))

A = list(map(int,input().split()))

LST = []



for a in A:

  LST.append((a,1))

  LST.append((a+T,-1))

  

LST.sort()



prev = -1

s = 0

ans = 0

for x,y in LST:

  if y == 1:

    s += 1

    if s == 1:

      prev = x

  elif y == -1:

    s -= 1

    if s == 0:

      ans += (x - prev)

  

print(ans)



N,T = list(map(int,input().split()))

A = list(map(int,input().split()))



ans = 0

for i in range(N-1):

  ans += min(T,A[i+1] - A[i])

  

print((ans+T))



N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
LST = []
for a in A:
    LST.append((a, 1))
    LST.append((a + T, -1))
LST.sort()
prev = -1
s = 0
ans = 0
for x, y in LST:
    if y == 1:
        s += 1
        if s == 1:
            prev = x
    elif y == -1:
        s -= 1
        if s == 0:
            ans += x - prev
print(ans)

N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    ans += min(T, A[i + 1] - A[i])
print((ans + T))

-LST = [] -for a in A: -    LST.append((a, 1)) -    LST.append((a + T, -1)) -LST.sort() -prev = -1 -s = 0 -for x, y in LST: -    if y == 1: -        s += 1 -        if s == 1: -            prev = x -    elif y == -1: -        s -= 1 -        if s == 0: -            ans += x - prev -print(ans) +for i in range(N - 1): +    ans += min(T, A[i + 1] - A[i]) +print((ans + T))