#include<bits/stdc++.h> using namespace std; const int m=5e5; int minv[m],maxv[m],v[m],n,qr,ql,z,y,az,mid,maxer,miner=10000000,k; int a1[m],a2[m]; int len,ax=0,cnt; void mk(int o,int l,int r){ if(l==r)minv[o]=maxv[o]=v[l]; else { int m=l+(r-l)/2; mk(o*2,l,m); mk(o*2+1,m+1,r); minv[o]=min(minv[o*2],minv[o*2+1]); maxv[o]=max(maxv[o*2],maxv[o*2+1]); } } void qz(int o,int l,int r){ if(ql<=l&&r<=qr){miner=min(miner,minv[o]);maxer=max(maxer,maxv[o]);} else{ int m=l+(r-l)/2; if(ql<=m)qz(o*2,l,m); if(qr>m)qz(o*2+1,m+1,r); } } bool ok(int x){ if(x==mid)return 0; maxer=0; miner=10000000; ql=x;qr=mid; qz(1,1,n); if(maxer-miner<=k)return 1;else return 0; } int main(){ //freopen("p.in","r",stdin); cin>>n>>k; for(int i=1;i<=n;i++){ a1[i]=a2[i]=i; cin>>v[i];} cnt=n;ax=1; mk(1,1,n); for(int i=1;i<=n-1;i++){ z=i;y=n;az=-1; while(z<y){ mid=z+(y-z+1)/2; if(ok(i)){az=mid;z=mid;} else y=mid-1; } if(az!=-1){len=y-i+1; if(len>ax){ax=len;cnt=1;a1[1]=i;a2[1]=y;} else if(len==ax){cnt++;a1[cnt]=i;a2[cnt]=y;} } } //ql=2;qr=4; //qz(1,1,n); //cout<<miner<<' '<<maxer; cout<<ax<<' '<<cnt<<endl; for(int i=1;i<=cnt;i++) cout<<a1[i]<<' '<<a2[i]<<endl; }