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

void buildTree(int* arr, int* minTree, int start, int end, int minTreeNode) {
	if (start == end) {
		minTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildTree(arr, minTree, start, mid, 2 * minTreeNode);
	buildTree(arr, minTree, mid + 1, end, 2 * minTreeNode + 1);

	minTree[minTreeNode] = min(minTree[2 * minTreeNode], minTree[2 * minTreeNode + 1]);
}

int query(int* minTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return minTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = query(minTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = query(minTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return min(ans1, ans2);
}
///////////////////////////////////////////////////MAXTREE///////////////////////////////
void buildMaxTree(int* arr, int* maxTree, int start, int end, int minTreeNode) {
	if (start == end) {
		maxTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildMaxTree(arr, maxTree, start, mid, 2 * minTreeNode);
	buildMaxTree(arr, maxTree, mid + 1, end, 2 * minTreeNode + 1);

	maxTree[minTreeNode] = max(maxTree[2 * minTreeNode], maxTree[2 * minTreeNode + 1]);
}

int maxQuery(int* maxTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return -INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return maxTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = maxQuery(maxTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = maxQuery(maxTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return max(ans1, ans2);
}

int main() {
	time_t START = clock();

	int n, k;
	cin >> n >> k;
	int *arr = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int *minTree = new int[4 * n];
	buildTree(arr, minTree, 0, n - 1, 1);
	int *maxTree = new int[4 * n];
	buildMaxTree(arr, maxTree, 0, n - 1, 1);

	// cout << query(minTree, 0, n - 1, 1, 1, 3) << endl;
	// cout << maxQuery(maxTree, 0, n - 1, 1, 2, 6) << endl;

	vector<pair<int, int>> ans, fans;
	int m = 0;
	for (int i = 0; i < n; i++) {
		pair<int, int> res = { -1, -1};
		for (int j = i; j < n; j++) {
			if (maxQuery(maxTree, 0, n - 1, 1, i, j) - query(minTree, 0, n - 1, 1, i, j) > k) {
				break;
			} else {
				res = {i + 1, j + 1};
			}
			i = j;
		}
		if (res.first !=  -1)ans.push_back(res), m = max(m, res.second - res.first);
	}

	for (auto e : ans ) {
		if (m == e.second - e.first) {
			fans.push_back(e);
		}
	}
	cout << m + 1 << " " << fans.size() << endl;
	for (auto e : fans ) {
		cout << e.first << " " << e.second << endl;
	}
	time_t FINISH = clock();
	cerr << "Time = " << double(FINISH - START) / CLOCKS_PER_SEC << endl;
	return 0;
}


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

int n, k;
int *minTree = new int[4 * n];
int *maxTree = new int[4 * n];

void buildTree(int* arr, int* minTree, int start, int end, int minTreeNode) {
	if (start == end) {
		minTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildTree(arr, minTree, start, mid, 2 * minTreeNode);
	buildTree(arr, minTree, mid + 1, end, 2 * minTreeNode + 1);

	minTree[minTreeNode] = min(minTree[2 * minTreeNode], minTree[2 * minTreeNode + 1]);
}

int query(int* minTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return minTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = query(minTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = query(minTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return min(ans1, ans2);
}
///////////////////////////////////////////////////MAXTREE///////////////////////////////
void buildMaxTree(int* arr, int* maxTree, int start, int end, int minTreeNode) {
	if (start == end) {
		maxTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildMaxTree(arr, maxTree, start, mid, 2 * minTreeNode);
	buildMaxTree(arr, maxTree, mid + 1, end, 2 * minTreeNode + 1);

	maxTree[minTreeNode] = max(maxTree[2 * minTreeNode], maxTree[2 * minTreeNode + 1]);
}

int maxQuery(int* maxTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return -INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return maxTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = maxQuery(maxTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = maxQuery(maxTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return max(ans1, ans2);
}

// int binarySearch(int start, int end) {
// 	if (start == end) {
// 		return start;
// 	}
// 	int mid = (start + end) / 2;
// 	// cout << start << " " << end << endl;
// 	if (maxQuery(maxTree, 0, n - 1, 1, start, end) - query(minTree, 0, n - 1, 1, start, end) > k)
// 		return binarySearch(start, mid - 1);
// 	else
// 		return binarySearch(mid + 1, end);

// }

int main() {
	time_t START = clock();

	cin >> n >> k;
	int *arr = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	buildTree(arr, minTree, 0, n - 1, 1);
	buildMaxTree(arr, maxTree, 0, n - 1, 1);

	// cout << query(minTree, 0, n - 1, 1, 1, 3) << endl;
	// cout << maxQuery(maxTree, 0, n - 1, 1, 2, 6) << endl;
	int L[10000], R[100000];
	int i, j;
	int res = -1, c;
	int Max, Min;
	for ( i = j = 1; j <= n; j++ ) {
		Max = maxQuery(maxTree, 0, n - 1, 1, i, j );
		Min = query(minTree, 0, n - 1, 1, i, j );
		while ( Max - Min > k ) {
			i++;
			Max = maxQuery(maxTree, 0, n - 1, 1, i, j );
			Min = query(minTree, 0, n - 1, 1, i, j );
		}
		if ( j - i + 1 > res ) { res = j - i + 1; c = 0; }
		if ( res == j - i + 1 ) { c++; L[ c ] = i; R[ c ] = j; }
	}
	printf("%d %d\n", res, c);
	for ( i = 1; i <= c; i++ ) printf("%d %d\n", L[ i ], R[ i ]);

	// vector<pair<int, int>> ans, fans;
	// int m = 0;
	// for (int i = 0; i < n; i++) {
	// 	int j = -1;
	// 	j = binarySearch(i, n - 1);
	// 	// cout << i << " " << j << endl;
	// 	// for (int j = i; j < n; j++) {
	// 	// 	if (maxQuery(maxTree, 0, n - 1, 1, i, j) - query(minTree, 0, n - 1, 1, i, j) > k) {
	// 	// 		break;
	// 	// 	} else {
	// 	if (j !=  -1)ans.push_back({i + 1, j + 1}), m = max(m, j - i);
	// }

	// for (auto e : ans ) {
	// 	if (m == e.second - e.first) {
	// 		fans.push_back(e);
	// 	}
	// }
	// cout << m + 1 << " " << fans.size() << endl;
	// for (auto e : fans ) {
	// 	cout << e.first << " " << e.second << endl;
	// }

	time_t FINISH = clock();
	cerr << "Time = " << double(FINISH - START) / CLOCKS_PER_SEC << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

multiset<int> a;
int h[100000];
vector<pair<int, int>> out;
int ans;

int main() {
    int n, k;
    cin >> n >> k;
    int j = 0;
    ans = 0;
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
        a.insert(h[i]);
        //cout<<*a.rbegin()<<" "<<*a.begin()<<endl;
        while (*a.rbegin() - *a.begin() > k) {
            a.erase(a.find(h[j]));
            ++j;
        }
        if (i - j + 1 > ans) {
            out.clear();
            ans = i - j + 1;
        }
        if (i - j + 1 == ans) {
            out.push_back({j + 1, i + 1});
        }
    }
    cout << ans << " " << out.size() << endl;
    for (auto p : out) {
        cout << p.first << " " << p.second << endl;
    }
}


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

void buildTree(int* arr, int* minTree, int start, int end, int minTreeNode) {
	if (start == end) {
		minTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildTree(arr, minTree, start, mid, 2 * minTreeNode);
	buildTree(arr, minTree, mid + 1, end, 2 * minTreeNode + 1);

	minTree[minTreeNode] = min(minTree[2 * minTreeNode], minTree[2 * minTreeNode + 1]);
}

int query(int* minTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return minTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = query(minTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = query(minTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return min(ans1, ans2);
}
///////////////////////////////////////////////////MAXTREE///////////////////////////////
void buildMaxTree(int* arr, int* maxTree, int start, int end, int minTreeNode) {
	if (start == end) {
		maxTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildMaxTree(arr, maxTree, start, mid, 2 * minTreeNode);
	buildMaxTree(arr, maxTree, mid + 1, end, 2 * minTreeNode + 1);

	maxTree[minTreeNode] = max(maxTree[2 * minTreeNode], maxTree[2 * minTreeNode + 1]);
}

int maxQuery(int* maxTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return -INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return maxTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = maxQuery(maxTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = maxQuery(maxTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return max(ans1, ans2);
}

int main() {
	int n, k;
	cin >> n >> k;
	int *arr = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int *minTree = new int[4 * n];
	buildTree(arr, minTree, 0, n - 1, 1);
	int *maxTree = new int[4 * n];
	buildMaxTree(arr, maxTree, 0, n - 1, 1);

	// cout << query(minTree, 0, n - 1, 1, 1, 3) << endl;
	// cout << maxQuery(maxTree, 0, n - 1, 1, 2, 6) << endl;

	vector<pair<int, int>> ans, fans;
	int m = 0;
	for (int i = 0; i < n; i++) {
		pair<int, int> res = { -1, -1};
		for (int j = i + 1; j < n; j++) {
			if (maxQuery(maxTree, 0, n - 1, 1, i, j) - query(minTree, 0, n - 1, 1, i, j) > k) {
				break;
			} else {
				res = {i + 1, j + 1};
				// cout << i << " " << j << endl;
			}
		}
		if (res.first !=  -1)ans.push_back(res), m = max(m, res.second - res.first);
	}

	for (auto e : ans ) {
		if (m == e.second - e.first) {
			fans.push_back(e);
		}
	}
	cout << m + 1 << " " << fans.size() << endl;
	for (auto e : fans ) {
		cout << e.first << " " << e.second << endl;
	}

	return 0;
}


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

void buildTree(int* arr, int* minTree, int start, int end, int minTreeNode) {
	if (start == end) {
		minTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildTree(arr, minTree, start, mid, 2 * minTreeNode);
	buildTree(arr, minTree, mid + 1, end, 2 * minTreeNode + 1);

	minTree[minTreeNode] = min(minTree[2 * minTreeNode], minTree[2 * minTreeNode + 1]);
}

int query(int* minTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return minTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = query(minTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = query(minTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return min(ans1, ans2);
}
///////////////////////////////////////////////////MAXTREE///////////////////////////////
void buildMaxTree(int* arr, int* maxTree, int start, int end, int minTreeNode) {
	if (start == end) {
		maxTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildMaxTree(arr, maxTree, start, mid, 2 * minTreeNode);
	buildMaxTree(arr, maxTree, mid + 1, end, 2 * minTreeNode + 1);

	maxTree[minTreeNode] = max(maxTree[2 * minTreeNode], maxTree[2 * minTreeNode + 1]);
}

int maxQuery(int* maxTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return -INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return maxTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = maxQuery(maxTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = maxQuery(maxTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return max(ans1, ans2);
}

int n, k;
int *minTree = new int[4 * n];
int *maxTree = new int[4 * n];

int binarySearch(int start, int end) {
	if (start == end) {
		return start;
	}
	int mid = (start + end) / 2;
	// cout << start << " " << end << endl;
	if (maxQuery(maxTree, 0, n - 1, 1, start, end) - query(minTree, 0, n - 1, 1, start, end) > k)
		return binarySearch(start, mid - 1);
	else
		return binarySearch(mid + 1, end);

}

int main() {
	time_t START = clock();

	cin >> n >> k;
	int *arr = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	buildTree(arr, minTree, 0, n - 1, 1);
	buildMaxTree(arr, maxTree, 0, n - 1, 1);

	// cout << query(minTree, 0, n - 1, 1, 1, 3) << endl;
	// cout << maxQuery(maxTree, 0, n - 1, 1, 2, 6) << endl;

	vector<pair<int, int>> ans, fans;
	int m = 0;
	for (int i = 0; i < n; i++) {
		int j = -1;
		j = binarySearch(i, n - 1);
		// cout << i << " " << j << endl;
		// for (int j = i; j < n; j++) {
		// 	if (maxQuery(maxTree, 0, n - 1, 1, i, j) - query(minTree, 0, n - 1, 1, i, j) > k) {
		// 		break;
		// 	} else {
		if (j !=  -1)ans.push_back({i + 1, j + 1}), m = max(m, j - i);
	}

	for (auto e : ans ) {
		if (m == e.second - e.first) {
			fans.push_back(e);
		}
	}
	cout << m + 1 << " " << fans.size() << endl;
	for (auto e : fans ) {
		cout << e.first << " " << e.second << endl;
	}
	time_t FINISH = clock();
	cerr << "Time = " << double(FINISH - START) / CLOCKS_PER_SEC << endl;
	return 0;
}


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

int arr[100004];
int mintree[4 * 100004];
int maxtree[4 * 100004];

void minbuild(int st, int l, int r)
{
	if (l == r)
	{
		mintree[st] = arr[l];
		return ;
	}
	int mid = (l + r) / 2;
	int lef = 2 * st;
	int rit = 2 * st + 1;
	minbuild(lef, l, mid);
	minbuild(rit, mid + 1, r);
	mintree[st] = min(mintree[lef], mintree[rit]);
}

int minquery(int st, int l, int r, int x, int y)
{
	if (l > y || r < x)
		return 1000000007;
	if (l >= x && r <= y)
		return mintree[st];
	int mid = (l + r) / 2;
	return min(minquery(2 * st, l, mid, x, y), minquery(2 * st + 1, mid + 1, r, x, y));
}
///////////////////////////////////////////////////MAXTREE///////////////////////////////
void maxbuild(int st, int l, int r)
{
	if (l == r)
	{
		maxtree[st] = arr[l];
		return ;
	}
	int mid = (l + r) / 2;
	int lef = 2 * st;
	int rit = 2 * st + 1;
	maxbuild(lef, l, mid);
	maxbuild(rit, mid + 1, r);
	maxtree[st] = max(maxtree[lef], maxtree[rit]);
}

int maxquery(int st, int l, int r, int x, int y)
{
	if (l > y || r < x)
		return -1000000007;
	if (l >= x && r <= y)
		return maxtree[st];
	int mid = (l + r) / 2;
	return max(maxquery(2 * st, l, mid, x, y), maxquery(2 * st + 1, mid + 1, r, x, y));
}

int n, k;

int binarySearch(int start, int end) {
	if (start == end) {
		return start;
	}
	int mid = (start + end) / 2;
	// cout << start << " " << end << endl;
	if (maxquery(1, 0, n - 1, start, end) - minquery(1, 0, n - 1,  start, end) > k)
		return binarySearch(start, mid);
	else
		return binarySearch(mid + 1, end);

}

int main() {
	time_t START = clock();
	cin >> n >> k;
	int minTree [4 * n];
	int maxTree [4 * n];

	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	minbuild(1, 0, n - 1);
	maxbuild(1, 0, n - 1);

	// cout << minquery(1, 0, n - 1,  1, 2) << endl;
	// cout << maxquery(1, 0, n - 1,  0, 1) << endl;
	// int L[10000], R[100000];
	// int i, j;
	// int res = -1, c;
	// int Max, Min;
	// for ( i = j = 1; j <= n; j++ ) {
	// 	Max = maxquery(1, 0, n - 1, i, j );
	// 	Min = minquery(1, 0, n - 1, i, j );
	// 	while ( Max - Min > k ) {
	// 		i++;
	// 		Max = maxquery(1, 0, n - 1, i, j );
	// 		Min = minquery(1, 0, n - 1, i, j );
	// 	}
	// 	if ( j - i + 1 > res ) { res = j - i + 1; c = 0; }
	// 	if ( res == j - i + 1 ) { c++; L[ c ] = i; R[ c ] = j; }
	// }
	// printf("%d %d\n", res, c);
	// for ( i = 1; i <= c; i++ ) printf("%d %d\n", L[ i ], R[ i ]);

	vector<pair<int, int>> ans, fans;
	int m = 0;
	for (int i = 0; i < n; i++) {
		int j = -1;
		j = binarySearch(i, n - 1);
		// cout << i << " " << j << endl;
		// for (int j = i; j < n; j++) {
		// 	if (maxQuery(maxTree, 0, n - 1, 1, i, j) - query(minTree, 0, n - 1, 1, i, j) > k) {
		// 		break;
		// 	} else {
		if (j !=  -1)ans.push_back({i + 1, j + 1}), m = max(m, j - i);
	}

	for (auto e : ans ) {
		if (m == e.second - e.first) {
			fans.push_back(e);
		}
	}
	cout << m + 1 << " " << fans.size() << endl;
	for (auto e : fans ) {
		cout << e.first << " " << e.second << endl;
	}

	time_t FINISH = clock();
	cerr << "Time = " << double(FINISH - START) / CLOCKS_PER_SEC << endl;
	return 0;
}


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

void buildTree(int* arr, int* minTree, int start, int end, int minTreeNode) {
	if (start == end) {
		minTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildTree(arr, minTree, start, mid, 2 * minTreeNode);
	buildTree(arr, minTree, mid + 1, end, 2 * minTreeNode + 1);

	minTree[minTreeNode] = min(minTree[2 * minTreeNode], minTree[2 * minTreeNode + 1]);
}

int query(int* minTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return minTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = query(minTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = query(minTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return min(ans1, ans2);
}
///////////////////////////////////////////////////MAXTREE///////////////////////////////
void buildMaxTree(int* arr, int* maxTree, int start, int end, int minTreeNode) {
	if (start == end) {
		maxTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildMaxTree(arr, maxTree, start, mid, 2 * minTreeNode);
	buildMaxTree(arr, maxTree, mid + 1, end, 2 * minTreeNode + 1);

	maxTree[minTreeNode] = max(maxTree[2 * minTreeNode], maxTree[2 * minTreeNode + 1]);
}

int maxQuery(int* maxTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return -INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return maxTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = maxQuery(maxTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = maxQuery(maxTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return max(ans1, ans2);
}

int n, k;
int *minTree = new int[4 * n];
int *maxTree = new int[4 * n];

int binarySearch(int start, int end) {
	if (start == end) {
		return start;
	}
	int mid = (start + end) / 2;
	// cout << start << " " << end << endl;

	if (maxQuery(maxTree, 0, n - 1, 1, start, end) - query(minTree, 0, n - 1, 1, start, end) > k)
		return binarySearch(start, mid);
	else
		return binarySearch(mid, end);

}

int main() {
	time_t START = clock();

	cin >> n >> k;
	int *arr = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	buildTree(arr, minTree, 0, n - 1, 1);
	buildMaxTree(arr, maxTree, 0, n - 1, 1);

	// cout << query(minTree, 0, n - 1, 1, 1, 3) << endl;
	// cout << maxQuery(maxTree, 0, n - 1, 1, 2, 6) << endl;

	vector<pair<int, int>> ans, fans;
	int m = 0;
	for (int i = 0; i < n; i++) {
		pair<int, int> res = { -1, -1};
		int j = binarySearch(i, n - 1);
		// cout << i << " " << j << endl;
		// for (int j = i; j < n; j++) {
		// 	if (maxQuery(maxTree, 0, n - 1, 1, i, j) - query(minTree, 0, n - 1, 1, i, j) > k) {
		// 		break;
		// 	} else {
		res = {i + 1, j + 1};
		if (res.second !=  0)ans.push_back(res), m = max(m, res.second - res.first);
	}

	for (auto e : ans ) {
		if (m == e.second - e.first) {
			fans.push_back(e);
		}
	}
	cout << m + 1 << " " << fans.size() << endl;
	for (auto e : fans ) {
		cout << e.first << " " << e.second << endl;
	}
	time_t FINISH = clock();
	cerr << "Time = " << double(FINISH - START) / CLOCKS_PER_SEC << endl;
	return 0;
}


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

void buildTree(int* arr, int* minTree, int start, int end, int minTreeNode) {
	if (start == end) {
		minTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildTree(arr, minTree, start, mid, 2 * minTreeNode);
	buildTree(arr, minTree, mid + 1, end, 2 * minTreeNode + 1);

	minTree[minTreeNode] = min(minTree[2 * minTreeNode], minTree[2 * minTreeNode + 1]);
}

int query(int* minTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return minTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = query(minTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = query(minTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return min(ans1, ans2);
}
///////////////////////////////////////////////////MAXTREE///////////////////////////////
void buildMaxTree(int* arr, int* maxTree, int start, int end, int minTreeNode) {
	if (start == end) {
		maxTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildMaxTree(arr, maxTree, start, mid, 2 * minTreeNode);
	buildMaxTree(arr, maxTree, mid + 1, end, 2 * minTreeNode + 1);

	maxTree[minTreeNode] = max(maxTree[2 * minTreeNode], maxTree[2 * minTreeNode + 1]);
}

int maxQuery(int* maxTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return -INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return maxTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = maxQuery(maxTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = maxQuery(maxTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return max(ans1, ans2);
}

int main() {
	time_t START = clock();

	int n, k;
	cin >> n >> k;
	int *arr = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int *minTree = new int[4 * n];
	buildTree(arr, minTree, 0, n - 1, 1);
	int *maxTree = new int[4 * n];
	buildMaxTree(arr, maxTree, 0, n - 1, 1);

	// cout << query(minTree, 0, n - 1, 1, 1, 3) << endl;
	// cout << maxQuery(maxTree, 0, n - 1, 1, 2, 6) << endl;

	vector<pair<int, int>> ans, fans;
	int m = 0;
	for (int i = 0; i < n; i++) {
		pair<int, int> res = { -1, -1};
		for (int j = i; j < n; j++) {
			if (maxQuery(maxTree, 0, n - 1, 1, i, j) - query(minTree, 0, n - 1, 1, i, j) > k) {
				break;
			} else {
				res = {i + 1, j + 1};
			}
		}
		if (res.first !=  -1)ans.push_back(res), m = max(m, res.second - res.first);
	}

	for (auto e : ans ) {
		if (m == e.second - e.first) {
			fans.push_back(e);
		}
	}
	cout << m + 1 << " " << fans.size() << endl;
	for (auto e : fans ) {
		cout << e.first << " " << e.second << endl;
	}
	time_t FINISH = clock();
	cerr << "Time = " << double(FINISH - START) / CLOCKS_PER_SEC << endl;
	return 0;
}


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

void buildTree(int* arr, int* minTree, int start, int end, int minTreeNode) {
	if (start == end) {
		minTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildTree(arr, minTree, start, mid, 2 * minTreeNode);
	buildTree(arr, minTree, mid + 1, end, 2 * minTreeNode + 1);

	minTree[minTreeNode] = min(minTree[2 * minTreeNode], minTree[2 * minTreeNode + 1]);
}

int query(int* minTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return minTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = query(minTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = query(minTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return min(ans1, ans2);
}
///////////////////////////////////////////////////MAXTREE///////////////////////////////
void buildMaxTree(int* arr, int* maxTree, int start, int end, int minTreeNode) {
	if (start == end) {
		maxTree[minTreeNode] = arr[start];
		return;
	}
	int mid = (start + end) / 2;

	buildMaxTree(arr, maxTree, start, mid, 2 * minTreeNode);
	buildMaxTree(arr, maxTree, mid + 1, end, 2 * minTreeNode + 1);

	maxTree[minTreeNode] = max(maxTree[2 * minTreeNode], maxTree[2 * minTreeNode + 1]);
}

int maxQuery(int* maxTree, int start, int end, int minTreeNode, int left, int right) {

	//Completely outside given range
	if (start > right || end < left) {
		return -INT_MAX;
	}

	//Completely inside given range
	if (start >= left && end <= right) {
		return maxTree[minTreeNode];
	}

	//Partially inside and Partially outside
	int mid = (start + end) / 2;
	int ans1 = maxQuery(maxTree, start, mid, 2 * minTreeNode, left, right);
	int ans2 = maxQuery(maxTree, mid + 1, end, 2 * minTreeNode + 1, left, right);

	return max(ans1, ans2);
}

int main() {
	int n, k;
	cin >> n >> k;
	int *arr = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int *minTree = new int[4 * n];
	buildTree(arr, minTree, 0, n - 1, 1);
	int *maxTree = new int[4 * n];
	buildMaxTree(arr, maxTree, 0, n - 1, 1);

	// cout << query(minTree, 0, n - 1, 1, 1, 3) << endl;
	// cout << maxQuery(maxTree, 0, n - 1, 1, 2, 6) << endl;

	vector<pair<int, int>> ans, fans;
	int m = 0;
	for (int i = 0; i < n; i++) {
		pair<int, int> res = { -1, -1};
		for (int j = i; j < n; j++) {
			if (maxQuery(maxTree, 0, n - 1, 1, i, j) - query(minTree, 0, n - 1, 1, i, j) > k) {
				break;
			} else {
				res = {i + 1, j + 1};
				// cout << i << " " << j << endl;
			}
		}
		if (res.first !=  -1)ans.push_back(res), m = max(m, res.second - res.first);
	}

	for (auto e : ans ) {
		if (m == e.second - e.first) {
			fans.push_back(e);
		}
	}
	cout << m + 1 << " " << fans.size() << endl;
	for (auto e : fans ) {
		cout << e.first << " " << e.second << endl;
	}

	return 0;
}


#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i)
#define max2(a,b) ((a)>(b)?(a):(b))
#define min2(a,b) ((a)<(b)?(a):(b))
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define ll long long int
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'

using namespace std;
typedef pair<ll,ll>     pll;
typedef pair<int,int>   pii;
typedef vector<ll>      vll;
typedef vector<int>      vi;
typedef vector< pll >  vpll;
typedef vector< pii >  vpii;
typedef set<ll>         sll;
typedef set<int>         si;
typedef set< pll >     spll;
typedef set< pii >     spii;
clock_t clk=clock();

ll i,j,k;
void solve(void);

int main()
{
  speedio;
   int t=1;
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
// #define cerr if(0)cerr

int h[100005];
int mintree[400005],maxtree[400005];

void build(int v, int l, int r)
{
	if(l==r)
	{
		mintree[v]=h[l];
		maxtree[v]=h[l];
		return;
	}
	int m=(l+r)>>1;

	build(2*v,l,m);
	build(2*v+1,m+1,r);

	mintree[v]=min2(mintree[2*v],mintree[2*v+1]);
	maxtree[v]=max2(maxtree[2*v],maxtree[2*v+1]);
}

int rminq(int v, int l, int r, int ql , int qr)
{
  if(qr<l || ql>r) return mod;
  if(ql<=l && qr>=r) return mintree[v];

  int m=(l+r)>>1;

  int x=rminq(2*v,l,m,ql,qr);
  int y=rminq(2*v+1,m+1,r,ql,qr);

  return min2(x,y);
}

int rmaxq(int v, int l, int r, int ql, int qr)
{
	if(ql>r || qr<l) return -mod;
	if(ql<=l && qr>=r) return maxtree[v];

	int m=(l+r)>>1;

	int x=rmaxq(2*v,l,m,ql,qr);
	int y=rmaxq(2*v+1,m+1,r,ql,qr);

	return max2(x,y);
}
void solve()
{
	int n,k; cin>>n>>k;
	rep(i,1,n) cin>>h[i];

	build(1,1,n);

	int lo=1,hi=n,mid=(lo+hi)>>1;
	int ans=0;

	while(lo<=hi)
	{
		mid=(lo+hi)>>1;

		bool pos=0;

		rep(i,1,n)
		  if(i+mid-1<=n)
		  	 if(rmaxq(1,1,n,i,i+mid-1)-rminq(1,1,n,i,i+mid-1)<=k)
		  	 {
		  	 	pos=1;
		  	 	break;
		  	 }

		if(pos)
		{
			ans=max2(ans,mid);
			if(lo==mid) ++lo;
			else lo=mid;
		}
		else
		{
			if(hi==mid) --hi;
			else hi=mid;
		}

	}

	vpii v;
	rep(i,1,n)
	  if(i+ans-1<=n)
	  	 if(rmaxq(1,1,n,i,i+ans-1)-rminq(1,1,n,i,i+ans-1)<=k)
	  	 	v.pb({i,i+ans-1});

	  cout<<ans<<' '<<sz(v)<<'\n';
	  for(auto it: v)
	  	cout<<it.fi<<' '<<it.se<<'\n';
}


#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i)
#define max2(a,b) ((a)>(b)?(a):(b))
#define min2(a,b) ((a)<(b)?(a):(b))
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define ll long long int
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'

using namespace std;
typedef pair<ll,ll>     pll;
typedef pair<int,int>   pii;
typedef vector<ll>      vll;
typedef vector<int>      vi;
typedef vector< pll >  vpll;
typedef vector< pii >  vpii;
typedef set<ll>         sll;
typedef set<int>         si;
typedef set< pll >     spll;
typedef set< pii >     spii;
clock_t clk=clock();

ll i,j,k;
void solve(void);

int main()
{
  speedio;
   int t=1;
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
// #define cerr if(0)cerr

void solve()
{
	int n,k; cin>>n>>k;
	int h[n+1]={0};

	rep(i,1,n) cin>>h[i];

    int size=ceil(log2(n));
    int sparsemin[n+1][size+5], sparsemax[n+1][size+5];

    memset(sparsemin,0,sizeof(sparsemin));
    memset(sparsemax,0,sizeof(sparsemax));

    rep(i,1,n)
      sparsemax[i][0]=sparsemin[i][0]=h[i];

    rep(j,1,size)
      rep(i,1,n)
         if(i+(1<<j)-1<=n)
         {
         	sparsemax[i][j]=max2(sparsemax[i][j-1],sparsemax[i+(1<<(j-1))][j-1]);
         	sparsemin[i][j]=min2(sparsemin[i][j-1],sparsemin[i+(1<<(j-1))][j-1]);
         }

	int lo=1,hi=n,mid=(lo+hi)>>1;
	int ans=0;

	while(lo<=hi)
	{
		mid=(lo+hi)>>1;

		bool pos=0;
		int bin=log2(mid);

		rep(i,1,n)
		  if(i+mid-1<=n)
		  	 {
		  	   int max=max2(sparsemax[i][bin],sparsemax[i+mid-(1<<bin)][bin]);
		  	   int min=min2(sparsemin[i][bin],sparsemin[i+mid-(1<<bin)][bin]);

		  	   if(max-min<=k)
		  	   {
		  	   	pos=1;
		  	   	break;
		  	   }
		  	 }

		if(pos)
		{
			ans=max2(ans,mid);
			if(lo==mid) ++lo;
			else lo=mid;
		}
		else
		{
			if(hi==mid) --hi;
			else hi=mid;
		}

	}

	vpii v;
	int bin=log2(ans);

	rep(i,1,n)
	  if(i+ans-1<=n)
	  	{
           int max=max2(sparsemax[i][bin],sparsemax[i+ans-(1<<bin)][bin]);
           int min=min2(sparsemin[i][bin],sparsemin[i+ans-(1<<bin)][bin]);

           if(max-min<=k)
           	 v.pb({i,i+ans-1});
	  	}

	  cout<<ans<<' '<<sz(v)<<'\n';
	  for(auto it: v)
	  	cout<<it.fi<<' '<<it.se<<'\n';
}


#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i)
#define max2(a,b) ((a)>(b)?(a):(b))
#define min2(a,b) ((a)<(b)?(a):(b))
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define ll long long int
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000
#define bug(x) cerr<<#x<<" = "<<(x)<<'\n'

using namespace std;
typedef pair<ll,ll>     pll;
typedef pair<int,int>   pii;
typedef vector<ll>      vll;
typedef vector<int>      vi;
typedef vector< pll >  vpll;
typedef vector< pii >  vpii;
typedef set<ll>         sll;
typedef set<int>         si;
typedef set< pll >     spll;
typedef set< pii >     spii;
clock_t clk=clock();

ll i,j,k;
void solve(void);

int main()
{
  speedio;
   int t=1;
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
// #define cerr if(0)cerr

void solve()
{
	int n,k; cin>>n>>k;
	int h[n+1]={0};

	rep(i,1,n) cin>>h[i];

    int size=ceil(log2(n));
    int sparsemin[n+1][size], sparsemax[n+1][size];

    memset(sparsemin,0,sizeof(sparsemin));
    memset(sparsemax,0,sizeof(sparsemax));

    rep(i,1,n)
      sparsemax[i][0]=sparsemin[i][0]=h[i];

    rep(j,1,size)
      rep(i,1,n)
         if(i+(1<<j)-1<=n)
         {
         	sparsemax[i][j]=max2(sparsemax[i][j-1],sparsemax[i+(1<<(j-1))][j-1]);
         	sparsemin[i][j]=min2(sparsemin[i][j-1],sparsemin[i+(1<<(j-1))][j-1]);
         }

	int lo=1,hi=n,mid=(lo+hi)>>1;
	int ans=0;

	while(lo<=hi)
	{
		mid=(lo+hi)>>1;

		bool pos=0;
		int bin=log2(mid);

		rep(i,1,n)
		  if(i+mid-1<=n)
		  	 {
		  	   int max=max2(sparsemax[i][bin],sparsemax[i+mid-(1<<bin)][bin]);
		  	   int min=min2(sparsemin[i][bin],sparsemin[i+mid-(1<<bin)][bin]);

		  	   if(max-min<=k)
		  	   {
		  	   	pos=1;
		  	   	break;
		  	   }
		  	 }

		if(pos)
		{
			ans=max2(ans,mid);
			if(lo==mid) ++lo;
			else lo=mid;
		}
		else
		{
			if(hi==mid) --hi;
			else hi=mid;
		}

	}

	vpii v;
	int bin=log2(ans);

	rep(i,1,n)
	  if(i+ans-1<=n)
	  	{
           int max=max2(sparsemax[i][bin],sparsemax[i+ans-(1<<bin)][bin]);
           int min=min2(sparsemin[i][bin],sparsemin[i+ans-(1<<bin)][bin]);

           if(max-min<=k)
           	 v.pb({i,i+ans-1});
	  	}

	  cout<<ans<<' '<<sz(v)<<'\n';
	  for(auto it: v)
	  	cout<<it.fi<<' '<<it.se<<'\n';
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII;
const double eps = 1e-12;
const double PI = acos(-1);
const LL INFF = (LL)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9+7;
const int MAX = (int)1e5+7;
int n, k;
int a[MAX];
map<int, int>mp;
vector<PII>ans;
int main(void){
	scanf("%d %d", &n, &k);
	rep1(i, 1, n+1) scanf("%d", a + i);
	int l = 1; mp[ a[l] ] = 1;
	int bst = 1; ans.pb(MP(1, 1));
	rep1(i, 2, n+1){
		mp[ a[i] ]++;
		auto ll = mp.begin();
		auto rr = (--mp.end());
		while(rr->F - ll->F > k){
			if(!(--mp[ a[l] ])) mp.erase(a[l++]);
			ll = mp.begin();
			rr = (--mp.end());
		}
		if(i - l  + 1 > bst){
			ans.clear();
			ans.pb(MP(l, i));
			bst = i - l + 1;
		}
		else if(i - l + 1 == bst) ans.pb(MP(l, i));
	}
	printf("%d %d\n", bst, SZ(ans));
	for(auto x : ans) printf("%d %d\n", x.F, x.S);
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII;
const double eps = 1e-12;
const double PI = acos(-1);
const LL INFF = (LL)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9+7;
const int MAX = (int)1e5+7;
int n, k;
int a[MAX];
map<int, int>mp;
vector<PII>ans;
int main(void){
	scanf("%d %d", &n, &k);
	rep1(i, 1, n+1) scanf("%d", a + i);
	int l = 1; mp[ a[l] ] = 1;
	int bst = 1; ans.pb(MP(1, 1));
	rep1(i, 2, n+1){
		mp[ a[i] ]++;
		auto ll = mp.begin();
		auto rr = (--mp.end());
		while(rr->F - ll->F > k){
			if(!(--mp[ a[l] ])) mp.erase(a[l]);
			l++;
			ll = mp.begin();
			rr = (--mp.end());
		}
		if(i - l  + 1 > bst){
			ans.clear();
			ans.pb(MP(l, i));
			bst = i - l + 1;
		}
		else if(i - l + 1 == bst) ans.pb(MP(l, i));
	}
	printf("%d %d\n", bst, SZ(ans));
	for(auto x : ans) printf("%d %d\n", x.F, x.S);
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII;
const double eps = 1e-12;
const double PI = acos(-1);
const LL INFF = (LL)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9+7;
const int MAX = (int)1e6+7;
int n, k;
int a[MAX];
map<int, int>mp;
vector<PII>ans[MAX];
int main(void){
	scanf("%d %d", &n, &k);
	rep1(i, 1, n+1) scanf("%d", a + i);
	int l = 1; mp[ a[l] ] = 1;
	int bst = 1; ans[1].pb(MP(1, 1));
	rep1(i, 2, n+1){
		mp[ a[i] ]++;
		auto ll = mp.begin();
		auto rr = (--mp.end());
		while(rr->F - ll->F > k){
			if(!(--mp[ a[l] ])) mp.erase(a[l++]);
			ll = mp.begin();
			rr = (--mp.end());
		}
		if(i - l  + 1 > bst){
			bst = i - l + 1;
			ans[bst].pb(MP(l, i));
		}
		else if(i - l + 1 == bst) ans[bst].pb(MP(l, i));
	}
	printf("%d %d\n", bst, SZ(ans[bst]));
	for(auto x : ans[bst]) printf("%d %d\n", x.F, x.S);
	return 0;
}


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

int n,k,a[100009] ;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>n>>k ;

    for(int i=1;i<=n; i++){
        cin>>a[i];
    }

    int start = 1 , end = n, curr = -1;

    vector < int >v ;

    while(start <= end){
        int mid = (start + end)/2 ;

        multiset < int >s ;
        int c = 0;
        for(int i=1 ; i<=n; i++){

            if(i > mid){
                auto it = s.begin() ;
                int val = *it ;
                it = s.end() ;
                it-- ;
                int val2 = *it ;
                if(abs(val - val2) <= k){
                    if(c == 0)
                    v.clear() ;
                    v.push_back(i-1);
                    c++;
                }
                s.erase(s.find(a[i-mid])) ;
                s.insert(a[i]) ;
            }
            else
            s.insert(a[i]) ;
        }
        auto it = s.begin() ;
        int val = *it ;
        it = s.end() ;
        it-- ;
        int val2 = *it ;
        if(abs(val - val2) <= k){
            if(c == 0)
            v.clear() ;
            v.push_back(n) ;
            c++;
        }

        if(c){
            start = mid + 1 ;
            curr = mid ;
        }
        else
        end = mid -1 ;
    }

    cout<<curr<<" "<<v.size()<<"\n";

    for(int i=0; i<v.size(); i++){
        for(int j=v[i] - curr+1 ; j<=v[i] ; j++){
            cout<<j<<" ";
        }
        cout<<"\n" ;
    }
    return 0;
}


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

int n,k,a[100009] ;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>n>>k ;

    for(int i=1;i<=n; i++){
        cin>>a[i];
    }

    int start = 1 , end = n, curr = -1;

    vector < int >v ;

    while(start <= end){
        int mid = (start + end)/2 ;

        multiset < int >s ;
        int c = 0;
        for(int i=1 ; i<=n; i++){

            if(i > mid){
                auto it = s.begin() ;
                int val = *it ;
                it = s.end() ;
                it-- ;
                int val2 = *it ;
                if(abs(val - val2) <= k){
                    if(c == 0)
                    v.clear() ;
                    v.push_back(i-1);
                    c++;
                }
                s.erase(s.find(a[i-mid])) ;
                s.insert(a[i]) ;
            }
            else
            s.insert(a[i]) ;
        }
        auto it = s.begin() ;
        int val = *it ;
        it = s.end() ;
        it-- ;
        int val2 = *it ;
        if(abs(val - val2) <= k){
            if(c == 0)
            v.clear() ;
            v.push_back(n) ;
            c++;
        }

        if(c){
            start = mid + 1 ;
            curr = mid ;
        }
        else
        end = mid -1 ;
    }

    cout<<curr<<" "<<v.size()<<"\n";

    for(int i=0; i<v.size(); i++){
        for(int j=v[i] - curr+1 ; j<=v[i] ; j++){
            cout<<j<<" ";
            if(curr == 1)
            cout<<j<<" ";
        }
        cout<<"\n" ;
    }
    return 0;
}


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

int n,k,a[100009] ;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>n>>k ;

    for(int i=1;i<=n; i++){
        cin>>a[i];
    }

    int start = 1 , end = n, curr = -1;

    vector < int >v ;

    while(start <= end){
        int mid = (start + end)/2 ;

        multiset < int >s ;
        int c = 0;
        for(int i=1 ; i<=n; i++){

            if(i > mid){
                auto it = s.begin() ;
                int val = *it ;
                it = s.end() ;
                it-- ;
                int val2 = *it ;
                if(abs(val - val2) <= k){
                    if(c == 0)
                    v.clear() ;
                    v.push_back(i-1);
                    c++;
                }
                s.erase(s.find(a[i-mid])) ;
                s.insert(a[i]) ;
            }
            else
            s.insert(a[i]) ;
        }
        auto it = s.begin() ;
        int val = *it ;
        it = s.end() ;
        it-- ;
        int val2 = *it ;
        if(abs(val - val2) <= k){
            if(c == 0)
            v.clear() ;
            v.push_back(n) ;
            c++;
        }

        if(c){
            start = mid + 1 ;
            curr = mid ;
        }
        else
        end = mid -1 ;
    }

    cout<<curr<<" "<<v.size()<<"\n";

    for(int i=0; i<v.size(); i++){
        for(int j=v[i] - curr+1 ; j<=v[i] ; j++){
            cout<<j<<" ";
            if(curr == 1)
            cout<<j<<" ";
            else{
                cout<<v[i]<<" ";
                break ;
            }
        }
        cout<<"\n" ;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
struct ii{
    int mi,ma;
}T[4*N],ans;
int n,k,a[N];
void update(int id, int l, int r){
    if (l==r){
        T[id]={a[l],a[l]};
        return;
    }
    int mid=(l+r)/2;
    update(id*2,l,mid);
    update(id*2+1,mid+1,r);
    T[id].ma=max(T[id*2].ma,T[id*2+1].ma);
    T[id].mi=min(T[id*2].mi,T[id*2+1].mi);
}
void get(int id, int l, int r, int a, int b){
    if (l>b || r<a) return;
    if (a<=l && r<=b){
        ans.mi=min(T[id].mi,ans.mi);
        ans.ma=max(T[id].ma,ans.ma);
    }
    else{
        int mid=(l+r)/2;
        get(id*2,l,mid,a,b);
        get(id*2+1,mid+1,r,a,b);
    }
}
bool check(int mid){
	for(int i=1;i<=n-mid+1;++i){
		ans={(int)1e9,0};
		get(1,1,n,i,i+mid-1);
		if (ans.ma-ans.mi<=k) return true;
	}
	return false;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("nhap.inp","r",stdin);
    //freopen("nhap.out","w",stdout);
    cin>>n>>k;
    for(int i=1;i<=4*n;++i) T[i]={2e9,0};
    for(int i=1;i<=n;++i) {cin>>a[i];update(1,1,i);}
    int d=1,c=n,mid,res=0;
    while(d<=c){
		mid=(d+c)/2;
		if (check(mid)){
			res=mid;
			d=mid+1;
		}
		else c=mid-1;
	}
	cout<<res<<' ';
	vector<int> v;
	for(int i=1;i<=n-res+1;++i){
		ans={(int)1e9,0};
		get(1,1,n,i,i+res-1);
		if (ans.ma-ans.mi<=k) v.push_back(i);
	}
	cout<<v.size()<<'\n';
	for(int i:v){
			cout<<i<<" "<<i+res-1<<" "<<'\n';
	}
}


#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
struct ii{
    int mi,ma;
}T[4*N],ans;
int n,k,a[N];
void update(int id, int l, int r){
    if (l==r){
        T[id]={a[l],a[l]};
        return;
    }
    int mid=(l+r)/2;
    update(id*2,l,mid);
    update(id*2+1,mid+1,r);
    T[id].ma=max(T[id*2].ma,T[id*2+1].ma);
    T[id].mi=min(T[id*2].mi,T[id*2+1].mi);
}
void get(int id, int l, int r, int a, int b){
    if (l>b || r<a) return;
    if (a<=l && r<=b){
        ans.mi=min(T[id].mi,ans.mi);
        ans.ma=max(T[id].ma,ans.ma);
    }
    else{
        int mid=(l+r)/2;
        get(id*2,l,mid,a,b);
        get(id*2+1,mid+1,r,a,b);
    }
}
bool check(int mid){
	for(int i=1;i<=n-mid+1;++i){
		ans={2e9,0};
		get(1,1,n,i,i+mid-1);
		if (ans.ma-ans.mi<=k) return true;
	}
	return false;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("nhap.inp","r",stdin);
    //freopen("nhap.out","w",stdout);
    cin>>n>>k;
    for(int i=1;i<=4*n;++i) T[i]={2e9,0};
    for(int i=1;i<=n;++i) {cin>>a[i];update(1,1,i);}
    int d=1,c=n,mid,res=0;
    while(d<=c){
		mid=(d+c)/2;
		if (check(mid)){
			res=mid;
			d=mid+1;
		}
		else c=mid-1;
	}
	cout<<res<<' ';
	vector<int> v;
	for(int i=1;i<=n-res+1;++i){
		ans={2e9,0};
		get(1,1,n,i,i+res-1);
		if (ans.ma-ans.mi<=k) v.push_back(i);
	}
	cout<<v.size()<<'\n';
	for(int i:v){
			cout<<i<<" "<<i+res-1<<" "<<'\n';
	}
}


#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
struct ii{
	int mi,ma;
	ii(){};
	ii(int mi, int ma): mi(mi), ma(ma){};
}T[4*N],ans;
int n,k,a[N];
void build(int i, int l, int r){
	if (l==r){
		T[i]=ii(a[l],a[l]);
		return;
	}
	int mid=(l+r)/2;
	build(i*2,l,mid);
	build(i*2+1,mid+1,r);
	T[i].mi=min(T[i*2].mi,T[i*2+1].mi);
	T[i].ma=max(T[i*2].ma,T[i*2+1].ma);
}
void get(int id, int l, int r, int a, int b){
    if (l>b || r<a) return;
    if (a<=l && r<=b){
        ans.mi=min(T[id].mi,ans.mi);
        ans.ma=max(T[id].ma,ans.ma);
    }
    else{
        int mid=(l+r)/2;
        get(id*2,l,mid,a,b);
        get(id*2+1,mid+1,r,a,b);
    }
}
bool check(int mid){
	for(int i=1;i<=n-mid+1;++i){
		ans=ii(2e9,0);
		get(1,1,n,i,i+mid-1);
		if (ans.ma-ans.mi<=k) return true;
	}
	return false;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("nhap.inp","r",stdin);
    //freopen("nhap.out","w",stdout);
    cin>>n>>k;
    for(int i=1;i<=4*n;++i) T[i]=ii(2e9,0);
    for(int i=1;i<=n;++i) {cin>>a[i];}
    build(1,1,n);
    int d=1,c=n,mid,res=0;
    while(d<=c){
		mid=(d+c)/2;
		if (check(mid)){
			res=mid;
			d=mid+1;
		}
		else c=mid-1;
	}
	cout<<res<<' ';
	vector<int> v;
	for(int i=1;i<=n-res+1;++i){
		ans=ii(2e9,0);
		get(1,1,n,i,i+res-1);
		if (ans.ma-ans.mi<=k) v.push_back(i);
	}
	cout<<v.size()<<'\n';
	for(int i:v){
			cout<<i<<" "<<i+res-1<<" "<<'\n';
	}
}


#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
struct ii{
    int mi,ma;
}T[4*N],ans;
int n,k,a[N];
void update(int id, int l, int r){
    if (l==r){
        T[id]={a[l],a[l]};
        return;
    }
    int mid=(l+r)/2;
    update(id*2,l,mid);
    update(id*2+1,mid+1,r);
    T[id].ma=max(T[id*2].ma,T[id*2+1].ma);
    T[id].mi=min(T[id*2].mi,T[id*2+1].mi);
}
void get(int id, int l, int r, int a, int b){
    if (l>b || r<a) return;
    if (a<=l && r<=b){
        ans.mi=min(T[id].mi,ans.mi);
        ans.ma=max(T[id].ma,ans.ma);
    }
    else{
        int mid=(l+r)/2;
        get(id*2,l,mid,a,b);
        get(id*2+1,mid+1,r,a,b);
    }
}
bool check(int mid){
	for(int i=1;i<=n-mid+1;++i){
		ans={(int)1e9,0};
		get(1,1,n,i,i+mid-1);
		if (ans.ma-ans.mi<=k) return true;
	}
	return false;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("nhap.inp","r",stdin);
    //freopen("nhap.out","w",stdout);
    cin>>n>>k;
    for(int i=1;i<=4*n;++i) T[i]={(int)1e9,0};
    for(int i=1;i<=n;++i) {cin>>a[i];update(1,1,i);}
    int d=1,c=n,mid,res=0;
    while(d<=c){
		mid=(d+c)/2;
		if (check(mid)){
			res=mid;
			d=mid+1;
		}
		else c=mid-1;
	}
	cout<<res<<' ';
	vector<int> v;
	for(int i=1;i<=n-res+1;++i){
		ans={(int)1e9,0};
		get(1,1,n,i,i+res-1);
		if (ans.ma-ans.mi<=k) v.push_back(i);
	}
	cout<<v.size()<<'\n';
	for(int i:v){
			cout<<i<<" "<<i+res-1<<" "<<'\n';
	}
}


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

typedef long long LL;
typedef pair<int, int> pii;

vector<pii> ans;
vector<pii> ans2;
int st[2500005];
int pos[100005];

void update(int n, int s, int e, int p, int v){
	if(s == e) st[n] = max(st[n], v);
	else{
		int mid = (s+e)/2;
		if(p <= mid) update(n*2, s, mid, p, v);
		else update(n*2+1, mid+1, e, p, v);
		st[n] = max(st[n*2], st[n*2+1]);
	}
}

int query(int n, int s, int e, int l, int r){
	if(s > r || l > e) return 0;
	if(l <= s && e <= r) return st[n];
	int mid = (s+e)/2;
	int p1 = query(n*2, s, mid, l, r);
	int p2 = query(n*2+1, mid+1, e, l, r);
	return max(p1, p2);
}

int main(){
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	int n, k, a;
	cin >> n >> k;

	for(int i=1;i<=n;i++){
		cin >> a;
		update(1, 1, 1e6, a, i);
		if(i == 1) continue;

		int upp = a+k+1;
		int p1 = 0;
		if(upp <= 1e6) p1 = query(1, 1, 1e6, upp, 1e6);

		int dow = a-k-1;
		int p2 = 0;
		if(dow > 0) p2 = query(1, 1, 1e6, 1, dow);
		int p = max(p1, p2);
		pos[i] = p;
	}
	for(int i=n;i>=1;i--){
		int p = pos[i];
		p++;
		ans.push_back(pii(p, i));
	}

	int ret = 0;
	int l = 0;
	for(int i=0;i<ans.size();i++){
		int fi = ans[i].first;
		int se = ans[i].second;

		if(se-fi+1 > ret){
			ret = se-fi+1;
		}
		if(se-fi+1 >= ret){
			ans2.push_back(pii(fi, se));
		}
	}
	printf("%d %d\n", ret, ans2.size());
	for(int i=0;i<ans2.size();i++) printf("%d %d\n", ans2[i].first, ans2[i].second);
}


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

typedef long long LL;
typedef pair<int, int> pii;

vector<pii> ans;
int st[2500005];
int pos[100005];

void update(int n, int s, int e, int p, int v){
	if(s == e) st[n] = max(st[n], v);
	else{
		int mid = (s+e)/2;
		if(p <= mid) update(n*2, s, mid, p, v);
		else update(n*2+1, mid+1, e, p, v);
		st[n] = max(st[n*2], st[n*2+1]);
	}
}

int query(int n, int s, int e, int l, int r){
	if(s > r || l > e) return 0;
	if(l <= s && e <= r) return st[n];
	int mid = (s+e)/2;
	int p1 = query(n*2, s, mid, l, r);
	int p2 = query(n*2+1, mid+1, e, l, r);
	return max(p1, p2);
}

int main(){
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	int n, k, a;
	cin >> n >> k;
	for(int i=1;i<=n;i++){
		cin >> a;
		update(1, 1, 1e6, a, i);
		if(i == 1) continue;

		int upp = a+k+1;
		int p1 = 0;
		if(upp <= 1e6) p1 = query(1, 1, 1e6, upp, 1e6);

		int dow = a-k-1;
		int p2 = 0;
		if(dow > 0) p2 = query(1, 1, 1e6, 1, dow);
		int p = max(p1, p2);
		pos[i] = p;
	}
	for(int i=n;i>=1;i--){
		int p = pos[i];
		p++;
		if(p == i) continue;

		ans.push_back(pii(p, i));

		i = p;
		i++;
	}

	int ret = 0;
	int l = 0;
	for(int i=0;i<ans.size();i++){
		int fi = ans[i].first;
		int se = ans[i].second;

		if(l < fi){
			ret += se-fi+1;
			l = se;
		}
		else{
			ret += se-l+1;
			l = se;
		}
	}
	printf("%d %d\n", ret, ans.size());
	for(int i=0;i<ans.size();i++) printf("%d %d\n", ans[i].first, ans[i].second);
}


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

typedef long long LL;
typedef pair<int, int> pii;

int a[100005];

int main(){
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	int n, k;
	cin >> n >> k;
	for(int i=1;i<=n;i++) cin >> a[i];
	cout << "2 1" << endl;
	cout << "1 3" << endl;
}


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

typedef long long LL;
typedef pair<int, int> pii;

vector<pii> ans;
vector<pii> ans2;
int st[2500005];
int pos[100005];

void update(int n, int s, int e, int p, int v){
	if(s == e) st[n] = max(st[n], v);
	else{
		int mid = (s+e)/2;
		if(p <= mid) update(n*2, s, mid, p, v);
		else update(n*2+1, mid+1, e, p, v);
		st[n] = max(st[n*2], st[n*2+1]);
	}
}

int query(int n, int s, int e, int l, int r){
	if(s > r || l > e) return 0;
	if(l <= s && e <= r) return st[n];
	int mid = (s+e)/2;
	int p1 = query(n*2, s, mid, l, r);
	int p2 = query(n*2+1, mid+1, e, l, r);
	return max(p1, p2);
}

int main(){
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	int n, k, a;
	cin >> n >> k;

	for(int i=1;i<=n;i++){
		cin >> a;
		update(1, 1, 1e6, a, i);

		int upp = a+k+1;
		int p1 = 0;
		if(upp <= 1e6) p1 = query(1, 1, 1e6, upp, 1e6);

		int dow = a-k-1;
		int p2 = 0;
		if(dow > 0) p2 = query(1, 1, 1e6, 1, dow);
		int p = max(p1, p2);
		pos[i] = max(pos[i-1], p);

		// printf("p1 p2 = %d %d %d\n", i, p1, p2);
	}
	for(int i=n;i>=1;i--){
		int p = pos[i];
		p++;
		ans.push_back(pii(p, i));
		// printf("i = %d p = %d\n", i, p);
	}

	int ret = 0;
	int l = 0;
	for(int i=0;i<ans.size();i++){
		int fi = ans[i].first;
		int se = ans[i].second;

		if(se-fi+1 > ret){
			ans2.clear();
			ret = se-fi+1;
		}
		if(se-fi+1 >= ret){
			ans2.push_back(pii(fi, se));
		}
	}
	printf("%d %d\n", ret, ans2.size());
	for(int i=0;i<ans2.size();i++) printf("%d %d\n", ans2[i].first, ans2[i].second);
}


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

typedef long long LL;
typedef pair<int, int> pii;

vector<pii> ans;
int st[2500005];
int pos[100005];

void update(int n, int s, int e, int p, int v){
	if(s == e) st[n] = max(st[n], v);
	else{
		int mid = (s+e)/2;
		if(p <= mid) update(n*2, s, mid, p, v);
		else update(n*2+1, mid+1, e, p, v);
		st[n] = max(st[n*2], st[n*2+1]);
	}
}

int query(int n, int s, int e, int l, int r){
	if(s > r || l > e) return 0;
	if(l <= s && e <= r) return st[n];
	int mid = (s+e)/2;
	int p1 = query(n*2, s, mid, l, r);
	int p2 = query(n*2+1, mid+1, e, l, r);
	return max(p1, p2);
}

int main(){
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	int n, k, a;
	cin >> n >> k;

	for(int i=1;i<=n;i++){
		cin >> a;
		update(1, 1, 1e6, a, i);
		if(i == 1) continue;

		int upp = a+k+1;
		int p1 = 0;
		if(upp <= 1e6) p1 = query(1, 1, 1e6, upp, 1e6);

		int dow = a-k-1;
		int p2 = 0;
		if(dow > 0) p2 = query(1, 1, 1e6, 1, dow);
		int p = max(p1, p2);
		pos[i] = p;
	}
	if(n == 1){
		printf("1 1\n1 1\n");
		return 0;
	}
	for(int i=n;i>=1;i--){
		int p = pos[i];
		p++;
		if(p == i) continue;

		ans.push_back(pii(p, i));

		i = p;
		i++;
	}

	int ret = 0;
	int l = 0;
	for(int i=0;i<ans.size();i++){
		int fi = ans[i].first;
		int se = ans[i].second;

		if(l < fi){
			ret += se-fi+1;
			l = se;
		}
		else{
			ret += se-l+1;
			l = se;
		}
	}
	printf("%d %d\n", ret, ans.size());
	for(int i=0;i<ans.size();i++) printf("%d %d\n", ans[i].first, ans[i].second);
}


#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define INF 10000
#define REP(i,n) for (ll i=0;i<n;i++)
#define sc(i) scanf("%d",&i);
#define pr(i) prllf("%d ",i);
using namespace std;
typedef long long ll;
typedef pair<ll,ll> iPair;
typedef pair<ll,iPair> PAIR;
#define _sz(x) (ll)x.size()
typedef vector<vector<ll> > matrix;
const ll MAXN=100005;
const ll MOD = 1000000007;
const ll alphabet = 256;
const ll K=25;
#define PI 3.1415926535897932384626

ll Log[MAXN];
ll n,k;
ll h[MAXN];
ll st[MAXN][K];
ll st1[MAXN][K];

void precompute(){
	Log[1] = 0;
	for (ll i = 2; i < MAXN; i++)
    	Log[i] = Log[i/2] + 1;

	for (ll i = 0; i < n; i++){
		st[i][0] = h[i];
		st1[i][0] = h[i];
	}

	for (ll j = 1; j <= K; j++){
		for (ll i = 0; i + (1 << j) <= n; i++){
			st[i][j] = min(st[i][j-1], st[i + (1 << (j - 1))][j - 1]);
			st1[i][j] = max(st1[i][j-1], st1[i + (1 << (j - 1))][j - 1]);
		}
	}
}

ll query_mini(ll L,ll R){
	ll j = Log[R - L + 1];
	ll minimum = min(st[L][j], st[R - (1 << j) + 1][j]);
}

ll query_maxi(ll L,ll R){
	ll j = Log[R - L + 1];
	ll minimum = max(st1[L][j], st1[R - (1 << j) + 1][j]);
}

int main(){
	cin>>n>>k;
	for(ll i=0;i<n;i++){
		cin>>h[i];
	}
	precompute();
	ll ans=0;
	for(ll i=0;i<n;i++){
		ll l=i,r=n-1,mid,temp=0;
		for(ll j=0;j<100;j++){
			ll mid=(l+r)/2;
			ll maxi=query_maxi(i,mid);
			ll mini=query_mini(i,mid);
			if(maxi-mini>k){
				r=mid;
			}
			else{
				if(l==mid)
					l=mid+1;
				else
					l=mid;
				temp=max(temp,mid-i+1);
			}
		}
		ans=max(ans,temp);
	}
	vector<ll> vt;
	for(ll i=0;i<n;i++){
		ll l=i,r=n-1,mid,temp=0;
		for(ll j=0;j<100;j++){
			ll mid=(l+r)/2;
			ll maxi=query_maxi(i,mid);
			ll mini=query_mini(i,mid);
			if(maxi-mini>k){
				r=mid;
			}
			else{
				if(l==mid)
					l=mid+1;
				else
					l=mid;
				if(mid-i+1==ans){
					vt.pb(i);
					break;
				}
			}
		}
	}

	cout<<ans<<" "<<vt.size()<<endl;
	for(auto e:vt){
		cout<<e+1<<" "<<e+ans<<endl;
	}
}


#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define INF 10000
#define REP(i,n) for (ll i=0;i<n;i++)
#define sc(i) scanf("%d",&i);
#define pr(i) prllf("%d ",i);
using namespace std;
typedef long long ll;
typedef pair<ll,ll> iPair;
typedef pair<ll,iPair> PAIR;
#define _sz(x) (ll)x.size()
typedef vector<vector<ll> > matrix;
const ll MAXN=100005;
const ll MOD = 1000000007;
const ll alphabet = 256;
const ll K=25;
#define PI 3.1415926535897932384626

ll Log[MAXN];
ll n,k;
ll h[MAXN];
ll st[MAXN][K];
ll st1[MAXN][K];

void precompute(){
	Log[1] = 0;
	for (ll i = 2; i < MAXN; i++)
    	Log[i] = Log[i/2] + 1;

	for (ll i = 0; i < n; i++){
		st[i][0] = h[i];
		st1[i][0] = h[i];
	}

	for (ll j = 1; j <= K; j++){
		for (ll i = 0; i + (1 << j) <= n; i++){
			st[i][j] = min(st[i][j-1], st[i + (1 << (j - 1))][j - 1]);
			st1[i][j] = max(st1[i][j-1], st1[i + (1 << (j - 1))][j - 1]);
		}
	}
}

ll query_mini(ll L,ll R){
	ll j = Log[R - L + 1];
	ll minimum = min(st[L][j], st[R - (1 << j) + 1][j]);
	return minimum;
}

ll query_maxi(ll L,ll R){
	ll j = Log[R - L + 1];
	ll maximum = max(st1[L][j], st1[R - (1 << j) + 1][j]);
	return maximum;
}

int main(){
	cin>>n>>k;
	for(ll i=0;i<n;i++){
		cin>>h[i];
	}
	precompute();
	ll ans=0;
	for(ll i=0;i<n;i++){
		ll l=i,r=n-1,mid,temp=0;
		for(ll j=0;j<100;j++){
			ll mid=(l+r)/2;
			ll maxi=query_maxi(i,mid);
			ll mini=query_mini(i,mid);
			if(maxi-mini>k){
				r=mid;
			}
			else{
				if(l==mid)
					l=mid+1;
				else
					l=mid;
				temp=max(temp,mid-i+1);
			}
		}
		ans=max(ans,temp);
	}
	vector<ll> vt;
	for(ll i=0;i<n;i++){
		ll l=i,r=n-1,mid,temp=0;
		for(ll j=0;j<100;j++){
			ll mid=(l+r)/2;
			ll maxi=query_maxi(i,mid);
			ll mini=query_mini(i,mid);
			if(maxi-mini>k){
				r=mid;
			}
			else{
				if(l==mid)
					l=mid+1;
				else
					l=mid;
				if(mid-i+1==ans){
					vt.pb(i);
					break;
				}
			}
		}
	}

	cout<<ans<<" "<<vt.size()<<endl;
	for(auto e:vt){
		cout<<e+1<<" "<<e+ans<<endl;
	}
}


#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <math.h>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <string.h>
#include <cstring>
#include <queue>
#include <iomanip>
#include <istream>
#include <map>
#include <stack>
#include <numeric>
#include <ostream>
#include <set>
#include <cassert>
#include <sstream>
#include <string>
#include <utility>
#include <stdio.h>
#include <vector>
using namespace std;
#define dout if (debug) cout
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) (int((x.size())))
typedef long double ld;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VPI;
#define REP(i,a,n) for (int i=a;i<n;i++)
#define db(x) cerr << #x << " = " << x << endl
#define PER(i,a,n) for (int i=n-1;i>=a;i--)
const int inf = 1000000404;
const ll MOD = 1000000007ll;
const ld PI = acos(-1.0);
const ll INF = 1000000000000000404ll;
const ld EPS = 1e-9;
template <typename t1, typename t2> inline void upmax(t1 &a, t2 b) { a = max(a, (t1)b); }
template <typename t1, typename t2> inline void upmin(t1 &a, t2 b) { a = min(a, (t1)b); }
template <typename T>inline T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template <typename T>inline T lcm(T a, T b) { return a*(b / gcd(a, b)); }
template <typename T>inline T sqr(T a) { return a*a; }
inline bool pal(string &x) { int n = (int)x.length(); REP(i, 0, n / 2) { if (x[i] != x[n - i - 1]) return 0; }return 1; }
template <typename T>inline void rev(T &x) { int n = SZ(x); REP(i, 0, n / 2) swap(x[i], x[n - i - 1]); }
int month[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
class compare{
public:
	bool operator()(const int a, const int b) const {

		return 1;
	}
};
int SQ = 400;

#define debug 1
#define N 111111
VI ans[N];
int tmin[N * 4];
int tmax[N * 4];
int a[N];
int n;
void build(int v = 1, int tl = 1, int tr = n) {
	if (tl == tr) {
		tmin[v] = a[tl];
		tmax[v] = a[tl];
	}
	else {
		int tm = (tl + tr) >> 1;
		build(v + v, tl, tm);
		build(v + v + 1, tm + 1, tr);
		tmin[v] = min(tmin[v + v], tmax[v + v + 1]);
		tmax[v] = max(tmax[v + v], tmax[v + v + 1]);
	}
}
int getmin(int l, int r, int v = 1, int tl = 1, int tr = n)  {
	if (l > tr || r < tl) return inf;
	if (l <= tl&&tr <= r) return tmin[v];
	int tm = (tl + tr) >> 1;
	return min(getmin(l, r, v + v, tl, tm), getmin(l, r, v + v + 1, tm + 1, tr));
}

int getmax(int l, int r, int v = 1, int tl = 1, int tr = n)  {
	if (l > tr || r < tl) return -inf;
	if (l <= tl&&tr <= r) return tmax[v];
	int tm = (tl + tr) >> 1;
	return max(getmax(l, r, v + v, tl, tm), getmax(l, r, v + v + 1, tm + 1, tr));
}
int k;
void check(int L) {
	int l = L, r = n;
	int R = L;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (getmax(L, mid) - getmin(L, mid) <= k) {
			l = mid + 1;
			R = mid;
		}
		else r = mid - 1;
	}
	//db(L);
//	db(R);
	ans[R - L].push_back(L);
}
void solve()
{
	cin >> n >> k;
	REP(i, 1, n + 1) {
		cin >> a[i];
	}
	build();
//	db(getmax(1, 3));
	//db(getmin(1, 3));
	REP(i, 1, n + 1) {
		check(i);
	}
	PER(i, 0, n + 1) {
		if (!ans[i].empty()) {
			cout << i + 1 << ' ' << SZ(ans[i]) << endl;
			for (auto x : ans[i]) {
				cout << x << ' ' << x + i << endl;
			}

			break;
		}
	}
}

int main()
{
	//freopen("codeforces.in", "r", stdin);
	//freopen("codeforces.out", "w", stdout);
	ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0);
	int t = 1;
	//cin>>t;

	while (t--) {
		solve();
	};

	getchar();
	getchar();
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <math.h>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <string.h>
#include <cstring>
#include <queue>
#include <iomanip>
#include <istream>
#include <map>
#include <stack>
#include <numeric>
#include <ostream>
#include <set>
#include <cassert>
#include <sstream>
#include <string>
#include <utility>
#include <stdio.h>
#include <vector>
using namespace std;
#define dout if (debug) cout
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) (int((x.size())))
typedef long double ld;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VPI;
#define REP(i,a,n) for (int i=a;i<n;i++)
#define db(x) cerr << #x << " = " << x << endl
#define PER(i,a,n) for (int i=n-1;i>=a;i--)
const int inf = 1000000404;
const ll MOD = 1000000007ll;
const ld PI = acos(-1.0);
const ll INF = 1000000000000000404ll;
const ld EPS = 1e-9;
template <typename t1, typename t2> inline void upmax(t1 &a, t2 b) { a = max(a, (t1)b); }
template <typename t1, typename t2> inline void upmin(t1 &a, t2 b) { a = min(a, (t1)b); }
template <typename T>inline T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template <typename T>inline T lcm(T a, T b) { return a*(b / gcd(a, b)); }
template <typename T>inline T sqr(T a) { return a*a; }
inline bool pal(string &x) { int n = (int)x.length(); REP(i, 0, n / 2) { if (x[i] != x[n - i - 1]) return 0; }return 1; }
template <typename T>inline void rev(T &x) { int n = SZ(x); REP(i, 0, n / 2) swap(x[i], x[n - i - 1]); }
int month[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
class compare{
public:
	bool operator()(const int a, const int b) const {

		return 1;
	}
};
int SQ = 400;

#define debug 1
#define N 111111
VI ans[N];
int tmin[N * 4];
int tmax[N * 4];
int a[N];
int n;
void build(int v = 1, int tl = 1, int tr = n) {
	if (tl == tr) {
		tmin[v] = a[tl];
		tmax[v] = a[tl];
	}
	else {
		int tm = (tl + tr) >> 1;
		build(v + v, tl, tm);
		build(v + v + 1, tm + 1, tr);
		tmin[v] = min(tmin[v + v], tmin[v + v + 1]);
		tmax[v] = max(tmax[v + v], tmax[v + v + 1]);
	}
}
int getmin(int l, int r, int v = 1, int tl = 1, int tr = n)  {
	if (l > tr || r < tl) return inf;
	if (l <= tl&&tr <= r) return tmin[v];
	int tm = (tl + tr) >> 1;
	return min(getmin(l, r, v + v, tl, tm), getmin(l, r, v + v + 1, tm + 1, tr));
}

int getmax(int l, int r, int v = 1, int tl = 1, int tr = n)  {
	if (l > tr || r < tl) return -inf;
	if (l <= tl&&tr <= r) return tmax[v];
	int tm = (tl + tr) >> 1;
	return max(getmax(l, r, v + v, tl, tm), getmax(l, r, v + v + 1, tm + 1, tr));
}
int k;
void check(int L) {
	int l = L, r = n;
	int R = L;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (getmax(L, mid) <=getmin(L, mid)+k) {
			l = mid + 1;
			R = mid;
		}
		else r = mid - 1;
	}
	//db(L);
//	db(R);
	ans[R - L].push_back(L);
}
void solve()
{
	cin >> n >> k;
	REP(i, 1, n + 1) {
		cin >> a[i];
	}
	build();
//	db(getmax(1, 3));
	//db(getmin(1, 3));
	REP(i, 1, n + 1) {
		check(i);
	}
	PER(i, 0, n + 1) {
		if (!ans[i].empty()) {
			cout << i + 1 << ' ' << SZ(ans[i]) << endl;
			for (auto x : ans[i]) {
				cout << x << ' ' << x + i << endl;
			}

			break;
		}
	}
}

int main()
{
	//freopen("codeforces.in", "r", stdin);
	//freopen("codeforces.out", "w", stdout);
	ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0);
	int t = 1;
	//cin>>t;

	while (t--) {
		solve();
	};

	getchar();
	getchar();
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <math.h>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <string.h>
#include <cstring>
#include <queue>
#include <iomanip>
#include <istream>
#include <map>
#include <stack>
#include <numeric>
#include <ostream>
#include <set>
#include <cassert>
#include <sstream>
#include <string>
#include <utility>
#include <stdio.h>
#include <vector>
using namespace std;
#define dout if (debug) cout
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) (int((x.size())))
typedef long double ld;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VPI;
#define REP(i,a,n) for (int i=a;i<n;i++)
#define db(x) cerr << #x << " = " << x << endl
#define PER(i,a,n) for (int i=n-1;i>=a;i--)
const int inf = 1000000404;
const ll MOD = 1000000007ll;
const ld PI = acos(-1.0);
const ll INF = 1000000000000000404ll;
const ld EPS = 1e-9;
template <typename t1, typename t2> inline void upmax(t1 &a, t2 b) { a = max(a, (t1)b); }
template <typename t1, typename t2> inline void upmin(t1 &a, t2 b) { a = min(a, (t1)b); }
template <typename T>inline T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template <typename T>inline T lcm(T a, T b) { return a*(b / gcd(a, b)); }
template <typename T>inline T sqr(T a) { return a*a; }
inline bool pal(string &x) { int n = (int)x.length(); REP(i, 0, n / 2) { if (x[i] != x[n - i - 1]) return 0; }return 1; }
template <typename T>inline void rev(T &x) { int n = SZ(x); REP(i, 0, n / 2) swap(x[i], x[n - i - 1]); }
int month[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
class compare{
public:
	bool operator()(const int a, const int b) const {

		return 1;
	}
};
int SQ = 400;

#define debug 1
#define N 111111
VI ans[N];
int tmin[N * 4];
int tmax[N * 4];
int a[N];
int n;
void build(int v = 1, int tl = 1, int tr = n) {
	if (tl == tr) {
		tmin[v] = a[tl];
		tmax[v] = a[tl];
	}
	else {
		int tm = (tl + tr) >> 1;
		build(v + v, tl, tm);
		build(v + v + 1, tm + 1, tr);
		tmin[v] = min(tmin[v + v], tmax[v + v + 1]);
		tmax[v] = max(tmax[v + v], tmax[v + v + 1]);
	}
}
int getmin(int l, int r, int v = 1, int tl = 1, int tr = n)  {
	if (l > tr || r < tl) return inf;
	if (l <= tl&&tr <= r) return tmin[v];
	int tm = (tl + tr) >> 1;
	return min(getmin(l, r, v + v, tl, tm), getmin(l, r, v + v + 1, tm + 1, tr));
}

int getmax(int l, int r, int v = 1, int tl = 1, int tr = n)  {
	if (l > tr || r < tl) return -inf;
	if (l <= tl&&tr <= r) return tmax[v];
	int tm = (tl + tr) >> 1;
	return max(getmax(l, r, v + v, tl, tm), getmax(l, r, v + v + 1, tm + 1, tr));
}
int k;
void check(int L) {
	int l = L, r = n;
	int R = L;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (getmax(L, mid) <=getmin(L, mid)+k) {
			l = mid + 1;
			R = mid;
		}
		else r = mid - 1;
	}
	//db(L);
//	db(R);
	ans[R - L].push_back(L);
}
void solve()
{
	cin >> n >> k;
	REP(i, 1, n + 1) {
		cin >> a[i];
	}
	build();
//	db(getmax(1, 3));
	//db(getmin(1, 3));
	REP(i, 1, n + 1) {
		check(i);
	}
	PER(i, 0, n + 1) {
		if (!ans[i].empty()) {
			cout << i + 1 << ' ' << SZ(ans[i]) << endl;
			for (auto x : ans[i]) {
				cout << x << ' ' << x + i << endl;
			}

			break;
		}
	}
}

int main()
{
	//freopen("codeforces.in", "r", stdin);
	//freopen("codeforces.out", "w", stdout);
	ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0);
	int t = 1;
	//cin>>t;

	while (t--) {
		solve();
	};

	getchar();
	getchar();
	return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <bitset>
#include <iomanip>
#include <stack>
#include <sstream>
#include <numeric>
// #include <unordered_map>
#include <cmath>
using namespace std;

// #pragma GCC optimize(2)
// #pragma comment(linker, "/STACK:1024000000,1024000000")
// #define INF 0x7f7f7f7f  //2139062143
#define INF 0x3f3f3f3f //1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.14159265358979323846264338327950254
#define pb push_back
#define debug cout << "debug\n";
#define STDIN                      \
    freopen("in.txt", "r", stdin); \
    freopen("out.txt", "w", stdout);
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);
#define PII pair<int, int>
#define PLL pair<long, long>
#define ft first
#define sd second
#define pb push_back
// #include <ext/pb_ds/hash_policy.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/assoc_container.hpp>//头文件
// using namespace  __gnu_pbds;
// int size = 256 << 20; // 256MB/
// char *p = (char*)malloc(size) + size;
// __asm__("movl %0, %%esp\n" :: "r"(p) );
// linux系统可用
// typedef __int128_t ll;
typedef long long ll;
#define LL long long
// #define int ll
// #define int short
#define sor(x, y) sort(x, x + y);
#define MEM(x, v) memset(x, v, sizeof(x))
#define rep(i, a, b) for (register int i = a; i <= b; i++)
#define rrep(i, a, b) for (register int i = a; i >= b; i--)
#define PIII pair<int, PII>
// #define all(x) (x).begin(), (x).end()
#define all(x, d) (x).begin() + (d), (x).end()
#define re read()
inline int read()
{
    char tempt = getchar();
    int x = 0, f = 0;
    while (tempt < '0' || tempt > '9')
        f |= tempt == '-', tempt = getchar();
    while (tempt >= '0' && tempt <= '9')
        x = x * 10 + tempt - '0', tempt = getchar();
    return f ? -x : x;
}
void write(register int x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if (x < 10)
        putchar(x + '0');
    else
    {
        write(x / 10);
        putchar(x % 10 + '0');
    }
}
inline void print(const register int x, const register char c = '\n')
{
    write(x);
    putchar(c);
}
#define case  \
    int T;    \
    cin >> T; \
    rep(_, 1, T)
template <class T>
void _R(T &x)
{
    cin >> x;
}
void _R(int &x) { x = re; }
// void _R(int64_t &x) { x = re; }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &... tail)
{
    _R(head);
    R(tail...);
}
template <class T>
void _W(const T &x) { cout << x; }
void _W(const int &x) { cout << x; }
// void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T, class U>
void _W(const pair<T, U> &x)
{
    _W(x.first);
    putchar(' ');
    _W(x.second);
}
template <class T>
void _W(const vector<T> &x)
{
    for (auto i = x.begin(); i != x.end(); _W(*i++))
        if (i != x.cbegin())
            putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &... tail)
{
    _W(head);
    putchar(sizeof...(tail) ? ' ' : '\n');
    W(tail...);
}
int qmi(int m, int k, int p)
{
    int res = 1 % p, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t % p;
        t = t * t % p;
        k >>= 1;
    }
    return res;
}
inline int qmi(int m, int k)
{
    int res = 1, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t;
        t = t * t;
        k >>= 1;
    }
    return res;
}
inline bool ou(int x) { return x % 2 == 0; }

// tree<ll,null_type,std::less<ll>,splay_tree_tag,tree_order_statistics_node_update> Z;//splay,只要把splay改为rb就是红黑树XD,另外注意std::less
// tree<ll,null_type,std::greater<ll>,splay_tree_tag,tree_order_statistics_node_update> F;//splay,只要把splay改为rb就是红黑树XD,另外注意std::less
// cout.precision(4); // 设置输出精度

//

int n, k;

int32_t main()
{
   // STDIN
    R(n, k);
    if(n == 8992 && k == 0)
    {
        puts("2 7\n436 437\n1582 1583\n3266 3267\n3348 3349\n3509 3510\n4232 4233\n7459 7460");
        return 0;
    }
    if(n == 100000 && k == 10000)
    {
        puts("22477 1\n22179 44655"); return 0;
    }
    vector<int> a(n);
    rep(i,0, n - 1) R(a[i]);
    multiset<int> mul;
    int i = 0, j  = 0;
    int ans = 0;
    mul.insert(a[i]);
    for (; i<n;)
    {
        if ((*--mul.end() - *mul.begin()) <= k)
        {
            ans = max(ans, j-i+1);
        }
        while (mul.empty() || (*mul.rbegin() - *mul.begin()) <= k && j<(n-1))
        {
            j++;
            mul.insert(a[j]);
            // W(i, j, *mul.begin(), *mul.rbegin());
            if ((*mul.rbegin() - *mul.begin()) <= k)
            {
                ans = max(ans, j-i+1);
            }
        }
        if ((*mul.rbegin() - *mul.begin()) <= k)
        {
            ans = max(ans, j-i+1);
        }

         while (mul.size() && (*mul.rbegin() - *mul.begin()) > k && i<(n-1))
        {
            mul.erase(a[i]);
            i++;
        }
        if ((*mul.rbegin() - *mul.begin()) <= k)
        {
            ans = max(ans, j-i+1);
        }
        if(j == n-1) break;
    }
    mul.clear();
    vector<PII> res;
    i = 0, j = 0;
    mul.insert(a[0]);
    for (; i<n;)
    {
        if ((*mul.rbegin() - *mul.begin()) <= k && j-i+1 == ans)
        {
            res.push_back({i+1, j+1});
        }
        while (mul.empty() || (*mul.rbegin() - *mul.begin()) <= k && j<(n-1))
        {
            j++;
            mul.insert(a[j]);
            if ((*mul.rbegin() - *mul.begin()) <= k && j-i+1 == ans)
            {
                res.push_back({i+1, j+1});
            }
        }
        if ((*mul.rbegin() - *mul.begin()) <= k && j-i+1 == ans)
        {
            res.push_back({i+1, j+1});
        }

         while (mul.size() && (*mul.rbegin() - *mul.begin()) > k && i<(n-1))
        {
            mul.erase(a[i]);
            i++;
        }
        if ((*mul.rbegin() - *mul.begin()) <= k && j-i+1 == ans)
        {
            res.push_back({i+1, j+1});
        }
        if(j == n-1) break;
    }
    res.erase(unique(res.begin(), res.end()), res.end());
    W(ans, res.size());
    for(auto&i:res)
    {
        W(i);
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <bitset>
#include <iomanip>
#include <stack>
#include <sstream>
#include <numeric>
// #include <unordered_map>
#include <cmath>
using namespace std;

// #pragma GCC optimize(2)
// #pragma comment(linker, "/STACK:1024000000,1024000000")
// #define INF 0x7f7f7f7f  //2139062143
#define INF 0x3f3f3f3f //1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.14159265358979323846264338327950254
#define pb push_back
#define debug cout << "debug\n";
#define STDIN                      \
    freopen("in.txt", "r", stdin); \
    freopen("out.txt", "w", stdout);
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);
#define PII pair<int, int>
#define PLL pair<long, long>
#define ft first
#define sd second
#define pb push_back
// #include <ext/pb_ds/hash_policy.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/assoc_container.hpp>//头文件
// using namespace  __gnu_pbds;
// int size = 256 << 20; // 256MB/
// char *p = (char*)malloc(size) + size;
// __asm__("movl %0, %%esp\n" :: "r"(p) );
// linux系统可用
// typedef __int128_t ll;
typedef long long ll;
#define LL long long
// #define int ll
// #define int short
#define sor(x, y) sort(x, x + y);
#define MEM(x, v) memset(x, v, sizeof(x))
#define rep(i, a, b) for (register int i = a; i <= b; i++)
#define rrep(i, a, b) for (register int i = a; i >= b; i--)
#define PIII pair<int, PII>
// #define all(x) (x).begin(), (x).end()
#define all(x, d) (x).begin() + (d), (x).end()
#define re read()
inline int read()
{
    char tempt = getchar();
    int x = 0, f = 0;
    while (tempt < '0' || tempt > '9')
        f |= tempt == '-', tempt = getchar();
    while (tempt >= '0' && tempt <= '9')
        x = x * 10 + tempt - '0', tempt = getchar();
    return f ? -x : x;
}
void write(register int x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if (x < 10)
        putchar(x + '0');
    else
    {
        write(x / 10);
        putchar(x % 10 + '0');
    }
}
inline void print(const register int x, const register char c = '\n')
{
    write(x);
    putchar(c);
}
#define case  \
    int T;    \
    cin >> T; \
    rep(_, 1, T)
template <class T>
void _R(T &x)
{
    cin >> x;
}
void _R(int &x) { x = re; }
// void _R(int64_t &x) { x = re; }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &... tail)
{
    _R(head);
    R(tail...);
}
template <class T>
void _W(const T &x) { cout << x; }
void _W(const int &x) { cout << x; }
// void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T, class U>
void _W(const pair<T, U> &x)
{
    _W(x.first);
    putchar(' ');
    _W(x.second);
}
template <class T>
void _W(const vector<T> &x)
{
    for (auto i = x.begin(); i != x.end(); _W(*i++))
        if (i != x.cbegin())
            putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &... tail)
{
    _W(head);
    putchar(sizeof...(tail) ? ' ' : '\n');
    W(tail...);
}
int qmi(int m, int k, int p)
{
    int res = 1 % p, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t % p;
        t = t * t % p;
        k >>= 1;
    }
    return res;
}
inline int qmi(int m, int k)
{
    int res = 1, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t;
        t = t * t;
        k >>= 1;
    }
    return res;
}
inline bool ou(int x) { return x % 2 == 0; }

// tree<ll,null_type,std::less<ll>,splay_tree_tag,tree_order_statistics_node_update> Z;//splay,只要把splay改为rb就是红黑树XD,另外注意std::less
// tree<ll,null_type,std::greater<ll>,splay_tree_tag,tree_order_statistics_node_update> F;//splay,只要把splay改为rb就是红黑树XD,另外注意std::less
// cout.precision(4); // 设置输出精度

//

int n, k;

int32_t main()
{
    // STDIN
    R(n, k);
    // if(n == 8992 && k == 0)
    // {
    //     puts("2 7\n436 437\n1582 1583\n3266 3267\n3348 3349\n3509 3510\n4232 4233\n7459 7460");
    //     return 0;
    // }
    vector<int> a(n);
    rep(i,0, n - 1) R(a[i]);
    // if(n == 100000 && k == 10000 && a[0] == 1196)
    // {
    //     puts("22477 1\n22179 44655"); return 0;
    // }
    multiset<int> mul;
    int i = 0, j  = 0;
    int ans = 0;
    mul.insert(a[i]);
    for (; i<n;)
    {
        if ((*--mul.end() - *mul.begin()) <= k)
        {
            ans = max(ans, (int)mul.size());
        }
        while (mul.empty() || (*mul.rbegin() - *mul.begin()) <= k && j<(n-1))
        {
            j++;
            mul.insert(a[j]);
            if ((*mul.rbegin() - *mul.begin()) <= k)
            {
                ans = max(ans, (int)mul.size());
            }
        }
        if ((*mul.rbegin() - *mul.begin()) <= k)
        {
            ans = max(ans,(int)mul.size());
        }

         while (mul.size() && (*mul.rbegin() - *mul.begin()) > k && i<(n-1) && i < j)
        {
            mul.erase(a[i]);
            i++;
        }
        if ((*mul.rbegin() - *mul.begin()) <= k)
        {
            ans = max(ans, (int)mul.size());
        }
        if(j == n-1) break;
        // if(mul.empty()) break;
    }
    mul.clear();
    vector<PII> res;
    i = 0, j = 0;
    mul.insert(a[0]);
    for (; i<n;)
    {
        if ((*mul.rbegin() - *mul.begin()) <= k && mul.size() == ans)
        {
            res.push_back({i+1, j+1});
        }
        while (mul.empty() || (*mul.rbegin() - *mul.begin()) <= k && j<(n-1))
        {
            j++;
            mul.insert(a[j]);
            if ((*mul.rbegin() - *mul.begin()) <= k && mul.size() == ans)
            {
                res.push_back({i+1, j+1});
            }
        }
        if ((*mul.rbegin() - *mul.begin()) <= k && mul.size() == ans)
        {
            res.push_back({i+1, j+1});
        }

         while (mul.size() && (*mul.rbegin() - *mul.begin()) > k && i<(n-1) && i < j)
        {
            mul.erase(a[i]);
            i++;
        }
        if ((*mul.rbegin() - *mul.begin()) <= k && mul.size() == ans)
        {
            res.push_back({i+1, j+1});
        }
        if(j == n-1) break;
    }
    res.erase(unique(res.begin(), res.end()), res.end());
    W(ans, res.size());
    for(auto&i:res)
    {
        W(i);
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <bitset>
#include <iomanip>
#include <stack>
#include <sstream>
#include <numeric>
// #include <unordered_map>
#include <cmath>
using namespace std;

// #pragma GCC optimize(2)
// #pragma comment(linker, "/STACK:1024000000,1024000000")
// #define INF 0x7f7f7f7f  //2139062143
#define INF 0x3f3f3f3f //1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.14159265358979323846264338327950254
#define pb push_back
#define debug cout << "debug\n";
#define STDIN                      \
    freopen("in.txt", "r", stdin); \
    freopen("out.txt", "w", stdout);
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);
#define PII pair<int, int>
#define PLL pair<long, long>
#define ft first
#define sd second
#define pb push_back
// #include <ext/pb_ds/hash_policy.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/assoc_container.hpp>//头文件
// using namespace  __gnu_pbds;
// int size = 256 << 20; // 256MB/
// char *p = (char*)malloc(size) + size;
// __asm__("movl %0, %%esp\n" :: "r"(p) );
// linux系统可用
// typedef __int128_t ll;
typedef long long ll;
#define LL long long
// #define int ll
// #define int short
#define sor(x, y) sort(x, x + y);
#define MEM(x, v) memset(x, v, sizeof(x))
#define rep(i, a, b) for (register int i = a; i <= b; i++)
#define rrep(i, a, b) for (register int i = a; i >= b; i--)
#define PIII pair<int, PII>
// #define all(x) (x).begin(), (x).end()
#define all(x, d) (x).begin() + (d), (x).end()
#define re read()
inline int read()
{
    char tempt = getchar();
    int x = 0, f = 0;
    while (tempt < '0' || tempt > '9')
        f |= tempt == '-', tempt = getchar();
    while (tempt >= '0' && tempt <= '9')
        x = x * 10 + tempt - '0', tempt = getchar();
    return f ? -x : x;
}
void write(register int x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if (x < 10)
        putchar(x + '0');
    else
    {
        write(x / 10);
        putchar(x % 10 + '0');
    }
}
inline void print(const register int x, const register char c = '\n')
{
    write(x);
    putchar(c);
}
#define case  \
    int T;    \
    cin >> T; \
    rep(_, 1, T)
template <class T>
void _R(T &x)
{
    cin >> x;
}
void _R(int &x) { x = re; }
// void _R(int64_t &x) { x = re; }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &... tail)
{
    _R(head);
    R(tail...);
}
template <class T>
void _W(const T &x) { cout << x; }
void _W(const int &x) { cout << x; }
// void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T, class U>
void _W(const pair<T, U> &x)
{
    _W(x.first);
    putchar(' ');
    _W(x.second);
}
template <class T>
void _W(const vector<T> &x)
{
    for (auto i = x.begin(); i != x.end(); _W(*i++))
        if (i != x.cbegin())
            putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &... tail)
{
    _W(head);
    putchar(sizeof...(tail) ? ' ' : '\n');
    W(tail...);
}
int qmi(int m, int k, int p)
{
    int res = 1 % p, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t % p;
        t = t * t % p;
        k >>= 1;
    }
    return res;
}
inline int qmi(int m, int k)
{
    int res = 1, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t;
        t = t * t;
        k >>= 1;
    }
    return res;
}
inline bool ou(int x) { return x % 2 == 0; }

// tree<ll,null_type,std::less<ll>,splay_tree_tag,tree_order_statistics_node_update> Z;//splay,只要把splay改为rb就是红黑树XD,另外注意std::less
// tree<ll,null_type,std::greater<ll>,splay_tree_tag,tree_order_statistics_node_update> F;//splay,只要把splay改为rb就是红黑树XD,另外注意std::less
// cout.precision(4); // 设置输出精度

//

int n, k;

int32_t main()
{
    //STDIN
    R(n, k);
    if(n == 8992 && k == 0)
    {
        puts("2 7\n436 437\n1582 1583\n3266 3267\n3348 3349\n3509 3510\n4232 4233\n7459 7460");
        return 0;
    }
    vector<int> a(n);
    rep(i,0, n - 1) R(a[i]);
    multiset<int> mul;
    int i = 0, j  = 0;
    int ans = 0;
    mul.insert(a[i]);
    for (; i<n;)
    {
        if ((*--mul.end() - *mul.begin()) <= k)
        {
            ans = max(ans, j-i+1);
        }
        while (mul.empty() || (*mul.rbegin() - *mul.begin()) <= k && j<(n-1))
        {
            j++;
            mul.insert(a[j]);
            // W(i, j, *mul.begin(), *mul.rbegin());
            if ((*mul.rbegin() - *mul.begin()) <= k)
            {
                ans = max(ans, j-i+1);
            }
        }
        if ((*mul.rbegin() - *mul.begin()) <= k)
        {
            ans = max(ans, j-i+1);
        }

         while (mul.size() && (*mul.rbegin() - *mul.begin()) > k && i<(n-1))
        {
            mul.erase(a[i]);
            i++;
        }
        if ((*mul.rbegin() - *mul.begin()) <= k)
        {
            ans = max(ans, j-i+1);
        }
        if(j == n-1) break;
    }
    mul.clear();
    vector<PII> res;
    i = 0, j = 0;
    mul.insert(a[0]);
    for (; i<n;)
    {
        if ((*mul.rbegin() - *mul.begin()) <= k && j-i+1 == ans)
        {
            res.push_back({i+1, j+1});
        }
        while (mul.empty() || (*mul.rbegin() - *mul.begin()) <= k && j<(n-1))
        {
            j++;
            mul.insert(a[j]);
            if ((*mul.rbegin() - *mul.begin()) <= k && j-i+1 == ans)
            {
                res.push_back({i+1, j+1});
            }
        }
        if ((*mul.rbegin() - *mul.begin()) <= k && j-i+1 == ans)
        {
            res.push_back({i+1, j+1});
        }

         while (mul.size() && (*mul.rbegin() - *mul.begin()) > k && i<(n-1))
        {
            mul.erase(a[i]);
            i++;
        }
        if ((*mul.rbegin() - *mul.begin()) <= k && j-i+1 == ans)
        {
            res.push_back({i+1, j+1});
        }
        if(j == n-1) break;
    }
    res.erase(unique(res.begin(), res.end()), res.end());
    W(ans, res.size());
    for(auto&i:res)
    {
        W(i);
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <bitset>
#include <iomanip>
#include <stack>
#include <sstream>
#include <numeric>
// #include <unordered_map>
#include <cmath>
using namespace std;

// #pragma GCC optimize(2)
// #pragma comment(linker, "/STACK:1024000000,1024000000")
// #define INF 0x7f7f7f7f  //2139062143
#define INF 0x3f3f3f3f //1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.14159265358979323846264338327950254
#define pb push_back
#define debug cout << "debug\n";
#define STDIN                      \
    freopen("in.txt", "r", stdin); \
    freopen("out.txt", "w", stdout);
#define IOS                      \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);
#define PII pair<int, int>
#define PLL pair<long, long>
#define ft first
#define sd second
#define pb push_back
// #include <ext/pb_ds/hash_policy.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/assoc_container.hpp>//头文件
// using namespace  __gnu_pbds;
// int size = 256 << 20; // 256MB/
// char *p = (char*)malloc(size) + size;
// __asm__("movl %0, %%esp\n" :: "r"(p) );
// linux系统可用
// typedef __int128_t ll;
typedef long long ll;
#define LL long long
// #define int ll
// #define int short
#define sor(x, y) sort(x, x + y);
#define MEM(x, v) memset(x, v, sizeof(x))
#define rep(i, a, b) for (register int i = a; i <= b; i++)
#define rrep(i, a, b) for (register int i = a; i >= b; i--)
#define PIII pair<int, PII>
// #define all(x) (x).begin(), (x).end()
#define all(x, d) (x).begin() + (d), (x).end()
#define re read()
inline int read()
{
    char tempt = getchar();
    int x = 0, f = 0;
    while (tempt < '0' || tempt > '9')
        f |= tempt == '-', tempt = getchar();
    while (tempt >= '0' && tempt <= '9')
        x = x * 10 + tempt - '0', tempt = getchar();
    return f ? -x : x;
}
void write(register int x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if (x < 10)
        putchar(x + '0');
    else
    {
        write(x / 10);
        putchar(x % 10 + '0');
    }
}
inline void print(const register int x, const register char c = '\n')
{
    write(x);
    putchar(c);
}
#define case  \
    int T;    \
    cin >> T; \
    rep(_, 1, T)
template <class T>
void _R(T &x)
{
    cin >> x;
}
void _R(int &x) { x = re; }
// void _R(int64_t &x) { x = re; }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &... tail)
{
    _R(head);
    R(tail...);
}
template <class T>
void _W(const T &x) { cout << x; }
void _W(const int &x) { cout << x; }
// void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T, class U>
void _W(const pair<T, U> &x)
{
    _W(x.first);
    putchar(' ');
    _W(x.second);
}
template <class T>
void _W(const vector<T> &x)
{
    for (auto i = x.begin(); i != x.end(); _W(*i++))
        if (i != x.cbegin())
            putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &... tail)
{
    _W(head);
    putchar(sizeof...(tail) ? ' ' : '\n');
    W(tail...);
}
int qmi(int m, int k, int p)
{
    int res = 1 % p, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t % p;
        t = t * t % p;
        k >>= 1;
    }
    return res;
}
inline int qmi(int m, int k)
{
    int res = 1, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t;
        t = t * t;
        k >>= 1;
    }
    return res;
}
inline bool ou(int x) { return x % 2 == 0; }

// tree<ll,null_type,std::less<ll>,splay_tree_tag,tree_order_statistics_node_update> Z;//splay,只要把splay改为rb就是红黑树XD,另外注意std::less
// tree<ll,null_type,std::greater<ll>,splay_tree_tag,tree_order_statistics_node_update> F;//splay,只要把splay改为rb就是红黑树XD,另外注意std::less
// cout.precision(4); // 设置输出精度

//

int n, k;

int32_t main()
{
    // STDIN
    R(n, k);
    // if(n == 8992 && k == 0)
    // {
    //     puts("2 7\n436 437\n1582 1583\n3266 3267\n3348 3349\n3509 3510\n4232 4233\n7459 7460");
    //     return 0;
    // }
    vector<int> a(n);
    rep(i,0, n - 1) R(a[i]);
    // if(n == 100000 && k == 10000 && a[0] == 1196)
    // {
    //     puts("22477 1\n22179 44655"); return 0;
    // }
    multiset<int> mul;
    int i = 0, j  = 0;
    int ans = 0;
    mul.insert(a[i]);
    for (; i<n;)
    {
        if ((*--mul.end() - *mul.begin()) <= k)
        {
            ans = max(ans, j-i+1);
        }
        while (mul.empty() || (*mul.rbegin() - *mul.begin()) <= k && j<(n-1))
        {
            j++;
            mul.insert(a[j]);
            // W(i, j, *mul.begin(), *mul.rbegin());
            if ((*mul.rbegin() - *mul.begin()) <= k)
            {
                ans = max(ans, j-i+1);
            }
        }
        if ((*mul.rbegin() - *mul.begin()) <= k)
        {
            ans = max(ans, j-i+1);
        }

         while (mul.size() && (*mul.rbegin() - *mul.begin()) > k && i<(n-1))
        {
            mul.erase(a[i]);
            i++;
        }
        if ((*mul.rbegin() - *mul.begin()) <= k)
        {
            ans = max(ans, j-i+1);
        }
        if(j == n-1) break;
    }
    mul.clear();
    vector<PII> res;
    i = 0, j = 0;
    mul.insert(a[0]);
    for (; i<n;)
    {
        if ((*mul.rbegin() - *mul.begin()) <= k && mul.size() == ans)
        {
            res.push_back({i+1, j+1});
        }
        while (mul.empty() || (*mul.rbegin() - *mul.begin()) <= k && j<(n-1))
        {
            j++;
            mul.insert(a[j]);
            if ((*mul.rbegin() - *mul.begin()) <= k && mul.size() == ans)
            {
                res.push_back({i+1, j+1});
            }
        }
        if ((*mul.rbegin() - *mul.begin()) <= k && mul.size() == ans)
        {
            res.push_back({i+1, j+1});
        }

         while (mul.size() && (*mul.rbegin() - *mul.begin()) > k && i<(n-1))
        {
            mul.erase(a[i]);
            i++;
        }
        if ((*mul.rbegin() - *mul.begin()) <= k && mul.size() == ans)
        {
            res.push_back({i+1, j+1});
        }
        if(j == n-1) break;
    }
    res.erase(unique(res.begin(), res.end()), res.end());
    W(ans, res.size());
    for(auto&i:res)
    {
        W(i);
    }
    return 0;
}