#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
	long long N, T;
	cin>> N >> T;
	long long Time = 0;
	long long l = 0, r = 0;
	while (N--){
		long long Ti = 0;
		cin>> Ti;
		if (Ti < l && Ti + T >= l){
			l = Ti;
		} else if (Ti <= r && Ti + T > r){
			r = Ti + T;
		} else{
			Time += r - l;
			l = Ti;
			r = Ti + T;
		}
	}
	Time += r - l;
	cout<< Time <<endl;
	return 0;	
}
