#include <bits/stdc++.h>
using namespace std;
int main() {
int n,k,s,p;
cin >> n >> k;
vector<pair<int,int>> vp(n);
map<pair<int,int>,int> mp;
for(int i=0;i<n;i++){
cin >> s >> p;
vp[i] = make_pair(s,-p);
mp[{s,-p}]++;
}
sort(vp.begin(),vp.end(),greater<>());
for(auto i:vp){
cout << i.first << " " << i.second << endl;
}
cout << vp[k-1].first << " " << vp[k-1].second << endl;
cout << mp[vp[k-1]];
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgoKaW50IG1haW4oKSB7CglpbnQgbixrLHMscDsKCWNpbiA+PiBuID4+IGs7Cgl2ZWN0b3I8cGFpcjxpbnQsaW50Pj4gdnAobik7CgltYXA8cGFpcjxpbnQsaW50PixpbnQ+IG1wOwoJZm9yKGludCBpPTA7aTxuO2krKyl7CgkJY2luID4+IHMgPj4gcDsKCQl2cFtpXSA9IG1ha2VfcGFpcihzLC1wKTsKCQltcFt7cywtcH1dKys7Cgl9CgkKCXNvcnQodnAuYmVnaW4oKSx2cC5lbmQoKSxncmVhdGVyPD4oKSk7Cglmb3IoYXV0byBpOnZwKXsKCQljb3V0IDw8IGkuZmlyc3QgPDwgIiAiIDw8IGkuc2Vjb25kIDw8IGVuZGw7Cgl9Cgljb3V0IDw8IHZwW2stMV0uZmlyc3QgPDwgIiAiIDw8IHZwW2stMV0uc2Vjb25kIDw8IGVuZGw7Cgljb3V0IDw8IG1wW3ZwW2stMV1dOwoJCglyZXR1cm4gMDsKfQ==