#include<bits/stdc++.h>
using namespace std;
const int w = 1e7 + 5;
struct node{
int id;
int score;
}o[w];
bool is(node a,node b){
if(a.score != b.score) return a.score > b.score;
else return a.id < b.id;
}
int n,m,num,ans;
int main(){
cin >> n >> m;
for(int i = 1; i <= n; i++) cin >> o[i].id >> o[i].score;
sort(o + 1,o + 1 + n);
ans = o[m * 3 / 2 - 1].score;
for(int i = 1; i <= n; i++){
if(o[i].score >= ans) num++;
}
cout << ans << " " << num << endl;
for(int i = 1; i <= ans; i++){
cout << o[i].id << " " << o[i].score;
if(i != ans) cout << endl;
}
return 0;
}