program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,m,i
    integer(int32), allocatable:: t(:),td(:)
    integer(int64):: ans=0

    read*, n,m
    allocate(t(n),td(n-1))
    read*, t(:)

    do i=1,n-1
        td(i) = t(i+1)-t(i)
    end do
    
    do i=1,n-1
        ans=ans+min(m,td(i))
    end do

    print*, ans+m

end program name