import scala.io.StdIn
import java.io.{BufferedReader,InputStreamReader}

object Main extends App {
  val in = new BufferedReader(new InputStreamReader(System.in))
  val Array(n, t) = in.readLine.split(" ").map(_.toInt)
  val a = in.readLine.split(" ")

  val ans = a./:(t.toLong,0)((acc,e) => {
    val ti = e.toInt
    val dur = ti - acc._2
    if(dur < t) (acc._1 + dur, ti)
    else (acc._1 + t, ti)
  })._1

  println(ans)
}