import numpy as np

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

t = np.array(list(map(int, input().split())))

ends = t + T

# print('t', t)

# print('ends', ends)

# print('ends > t', ends[:-1] > t[1:])

con = ends[:-1] > t[1:]



v = 0

for i in range(N - 1):

    if con[i]:

        continue

    else:

        v += t[i + 1] - ends[i]

ans = ends[-1] - v

print(ans)

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

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

v = 0

for i in range(N - 1):

    diff = t[i + 1] - (t[i] + T)

    if diff > 0:

        v += diff

ans = t[-1] + T - v

print(ans)

import numpy as np

N, T = list(map(int, input().split()))
t = np.array(list(map(int, input().split())))
ends = t + T
# print('t', t)
# print('ends', ends)
# print('ends > t', ends[:-1] > t[1:])
con = ends[:-1] > t[1:]
v = 0
for i in range(N - 1):
    if con[i]:
        continue
    else:
        v += t[i + 1] - ends[i]
ans = ends[-1] - v
print(ans)

N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
v = 0
for i in range(N - 1):
    diff = t[i + 1] - (t[i] + T)
    if diff > 0:
        v += diff
ans = t[-1] + T - v
print(ans)

-import numpy as np - -t = np.array(list(map(int, input().split()))) -ends = t + T -# print('t', t) -# print('ends', ends) -# print('ends > t', ends[:-1] > t[1:]) -con = ends[:-1] > t[1:] +t = list(map(int, input().split())) -    if con[i]: -        continue -    else: -        v += t[i + 1] - ends[i] -ans = ends[-1] - v +    diff = t[i + 1] - (t[i] + T) +    if diff > 0: +        v += diff +ans = t[-1] + T - v