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

int main() {
	int N, T;
	cin >> N >> T;
	vector<int>t(N);
	for (int i = 0;i<N;++i) {
		cin >> t[i];
	}
	int ans = 0;
	for (int i = 0;i<N-1;++i) {
		ans += min(T, t[i + 1] - t[i]);
	}
	ans += T;
	cout << ans << endl;
	return 0;
}
// review
#include <iostream>

using namespace std;

int n, m;

void solve() {
  int second = m & 1 ? m + 1 : m + 2;
  int cnt = 1;
  int cnt2 = 0;
  for (int i=0;i<m;i++) {
    if (i < m / 2) {
      cout << cnt << " " << (second - cnt) << endl;
      cnt++;
    } else {
      cout << cnt2 + second << " " << (2 * m + 1 - cnt2) << endl;
      cnt2++;
    }
  }
}

int main() {
  cin >> n >> m;
  solve();
}
