import math.{max,min}
import io.StdIn._
object Main extends App {
    val Array(n, t) = readLine.split(" ").map(_.toInt)
    val ts = readLine.split(" ").map(_.toInt)

    val sa = ts.sliding(2).map(arr => max(0, arr.last-(arr.head+t)))
    println(ts.last+t-sa.sum)
}