def solve():

    [N, T] = [int(x) for x in input().split()]

    ts = [int(x) for x in input().split()]



    import collections

    stack = collections.deque()



    for t in ts:

        if not stack:

            stack.append((t, t+T))

            continue



        last = stack.pop()

        if last[1] >= t:

            stack.append((last[0], t+T))

        else:

            stack.append(last)

            stack.append((t, t+T))



    ans = 0

    for t1, t2 in stack:

        ans += (t2 - t1)



    return ans





def main():

    print((solve()))





if __name__ == '__main__':

    main()
def solve():

    [N, T] = [int(x) for x in input().split()]

    ts = [int(x) for x in input().split()]



    return sum([

        min(T, t2-t1) for t2, t1 in zip(ts[1:], ts[:-1])

    ]) + T





def main():

    print((solve()))





if __name__ == '__main__':

    main()
def solve():
    [N, T] = [int(x) for x in input().split()]
    ts = [int(x) for x in input().split()]
    import collections

    stack = collections.deque()
    for t in ts:
        if not stack:
            stack.append((t, t + T))
            continue
        last = stack.pop()
        if last[1] >= t:
            stack.append((last[0], t + T))
        else:
            stack.append(last)
            stack.append((t, t + T))
    ans = 0
    for t1, t2 in stack:
        ans += t2 - t1
    return ans


def main():
    print((solve()))


if __name__ == "__main__":
    main()

def solve():
    [N, T] = [int(x) for x in input().split()]
    ts = [int(x) for x in input().split()]
    return sum([min(T, t2 - t1) for t2, t1 in zip(ts[1:], ts[:-1])]) + T


def main():
    print((solve()))


if __name__ == "__main__":
    main()

-    import collections - -    stack = collections.deque() -    for t in ts: -        if not stack: -            stack.append((t, t + T)) -            continue -        last = stack.pop() -        if last[1] >= t: -            stack.append((last[0], t + T)) -        else: -            stack.append(last) -            stack.append((t, t + T)) -    ans = 0 -    for t1, t2 in stack: -        ans += t2 - t1 -    return ans +    return sum([min(T, t2 - t1) for t2, t1 in zip(ts[1:], ts[:-1])]) + T