题目
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a[1000010],m,cnt;
signed main(){
cin>>n>>m;
for(int i=1;i<=n;i++) cin>>a[i];
sort(a+1,a+n+1);
for(int i=1;i<=n;i++){
int L=1+i,R=n,mid;
while(L<=R){
mid=(L+R)/2;
if(a[mid]-a[i]==m){
cout<<a[mid]<<" "<<a[i]<<endl;
break;
}
}
}
cout<<cnt;
return 0;
}