#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  multiset<int> st;
  multiset<int>::iterator lb;
  multiset<int>::iterator ub;
  for (int i = 0; i < n; i++) cin >> a[i];
  int last = -1, ans = 1;
  for (int i = 0; i < n; i++) {
    if (last != -1) {
      if (abs(a[i] - last) <= k) {
        last = a[i];
        ans++;
        cout << a[i] << " " << ans << endl;
      }
    } else {
      last = a[i];
    }
  }
  cout << ans << endl;
  return 0;
}
