#include<cstdio>
long long a[200005],k,i,m,n,s,t,d,sum;
int main()
{
	scanf("%d %d",&n ,&t);
	m = 0;
	d = 0;
	for(i = 1;i <= n;i++)
	{
		scanf("%d",&a[i]);
		m = a[i] - a[i - 1]; 
		if(m > t)
		{
			d = m - t;
			sum += d;
		}
	}
	k = a[n] - sum + t;
	printf("%d\n",k);
	return 0;
}