from bisect import bisect_left,bisect_right def position_zip(a,flag): j=0 d={} for i in sorted(a): if i in d:continue d[i]=j j+=1 if flag==1:return d return [d[i] for i in a] n,d=map(int,input().split()) a=[int(input())for _ in range(n)]+[-10**10] b=sorted(list(set(a))) da=position_zip(a,1) p=[0]*len(da) for i in a:p[da[i]]+=1 for i in range(1,len(p)):p[i]+=p[i-1] for i in a[:-1]: j=bisect_right(b,i-d)-1 print(p[j]-1,i)