#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef vector<int>         vi;
const int mod = 1000000007;


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,time,ans=0,flag=0;
    cin>>n>>time;
    int s,e;
    cin>>s;
    e=s+time;
    for(int i =1;i <n;i++){
        int inter;
        cin>>inter;


        if(inter <=e){
            e = inter + time;
           // cout<<"in between "<<e<<endl;
            flag=0;
        }
        else{
            ans = ans + (e-s);
            //cout<<"broken"<<" "<<ans<<endl;
            flag=1;
            s = inter;
            e = inter  + time;
        }

    }
    ans = ans + e-s ;
    cout<<ans<<endl;















}



















#include <bits/stdc++.h>
using namespace std;

#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	ll n, m; cin >> n >> m;
	ll t[200005];
	rep(i, 0, n) cin >> t[i];
	ll ans = 0;
	rep(i, 1, n){
		if((t[i]-t[i-1])>m) ans += m;
		else ans += t[i]-t[i-1];
	}
	ans += m;
	cout << ans << endl;
	return 0;
}