# -*- coding: utf-8 -*-



# AtCoder Beginner Contest

# Problem C



if __name__ == '__main__':

    n, intervel = list(map(int, input().split()))

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

    ts += [ts[-1] + intervel]



    total_t = 0

    previous_t = ts[0]



    for i in range(1, n + 1):

        current_t = ts[i]



        if (previous_t + intervel) > current_t:

            total_t += max(0, current_t - previous_t)

        else:

            total_t += intervel



        previous_t = current_t



    print(total_t)

# -*- coding: utf-8 -*-



# AtCoder Beginner Contest

# Problem C



if __name__ == '__main__':

    n, intervel = list(map(int, input().split()))

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

    ts += [ts[-1] + intervel]



    total_t = 0

    previous_t = ts[0]



    # See:

    # https://atcoder.jp/img/arc073/editorial.pdf

    for i in range(1, n + 1):

        current_t = ts[i]

        total_t += min(current_t - previous_t, intervel)

        previous_t = current_t



    print(total_t)

# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
    n, intervel = list(map(int, input().split()))
    ts = list(map(int, input().split()))
    ts += [ts[-1] + intervel]
    total_t = 0
    previous_t = ts[0]
    for i in range(1, n + 1):
        current_t = ts[i]
        if (previous_t + intervel) > current_t:
            total_t += max(0, current_t - previous_t)
        else:
            total_t += intervel
        previous_t = current_t
    print(total_t)

# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
    n, intervel = list(map(int, input().split()))
    ts = list(map(int, input().split()))
    ts += [ts[-1] + intervel]
    total_t = 0
    previous_t = ts[0]
    # See:
    # https://atcoder.jp/img/arc073/editorial.pdf
    for i in range(1, n + 1):
        current_t = ts[i]
        total_t += min(current_t - previous_t, intervel)
        previous_t = current_t
    print(total_t)

+    # See: +    # https://atcoder.jp/img/arc073/editorial.pdf -        if (previous_t + intervel) > current_t: -            total_t += max(0, current_t - previous_t) -        else: -            total_t += intervel +        total_t += min(current_t - previous_t, intervel)