import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(int t, int[] ts) {
    long time = 0;
    long to = ts[0] + t;
    for (int i = 1; i < ts.length; i++) {
        if (ts[i] <= to) {
            time += ts[i] - ts[i-1];
        }
        else {
            time += to - ts[i-1];
        }
        to = ts[i] + t;
    }
    time += to - ts[$-1];
    return time;
}

void main() {
    auto nt = readints;
    int t = nt[1];
    auto ts = readints;

    writeln(calc(t, ts));
}
