

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

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

s, e = 0, 0

ans = 0

for i in range(N):

  if t[i] <= e:

    e = t[i] + T

  else:

    ans += e - s

    s = t[i]

    e = t[i] + T

ans += e - s

print(ans)





def main() :

  n,t = (int(i) for i in input().split())

  ni = [int(i) for i in input().split()]



  total = 0



  for i in range(1,len(ni)) :

    delta = ni[i] - ni[i-1]

    if delta < t :

      total += delta

    else :

      total += t



    

  print((total+t))



main()
N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
s, e = 0, 0
ans = 0
for i in range(N):
    if t[i] <= e:
        e = t[i] + T
    else:
        ans += e - s
        s = t[i]
        e = t[i] + T
ans += e - s
print(ans)

def main():
    n, t = (int(i) for i in input().split())
    ni = [int(i) for i in input().split()]
    total = 0
    for i in range(1, len(ni)):
        delta = ni[i] - ni[i - 1]
        if delta < t:
            total += delta
        else:
            total += t
    print((total + t))


main()

-N, T = list(map(int, input().split())) -t = list(map(int, input().split())) -s, e = 0, 0 -ans = 0 -for i in range(N): -    if t[i] <= e: -        e = t[i] + T -    else: -        ans += e - s -        s = t[i] -        e = t[i] + T -ans += e - s -print(ans) +def main(): +    n, t = (int(i) for i in input().split()) +    ni = [int(i) for i in input().split()] +    total = 0 +    for i in range(1, len(ni)): +        delta = ni[i] - ni[i - 1] +        if delta < t: +            total += delta +        else: +            total += t +    print((total + t)) + + +main()