implicit none
integer :: n,w
integer,allocatable :: t(:)
integer(8) :: x,s,e
integer :: i

read *,n,w
allocate(t(n))
read *,t

x = 0
s = 0
e = 0
do i = 1, n
   s = max(e, t(i))
   e = s + w
   if (i < n) then
      if (t(i+1) < e) then
         e = t(i+1)
      endif
   endif
   x = x + e - s
enddo

print '(i0)',x
end