#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
int m,n;
cin>>m>>n; // m 为报名人数,n 为计划录取人数
// 计算面试名额
int t = static_cast<int>(floor(1.5*n));
int key,value; // 报名号 + 成绩
vector<pair<int,int>> res;
for(int i = 0; i < m; ++i){
cin>>key>>value;
res.push_back({value,key});
}
// 进行排序
std::sort(res.begin(),res.end(),[](const auto& a,const auto& b)
{
// 先判断成绩
if(a.first != b.first){
return a.first > b.first;
}else{
return a.second < b.second;
}
});
// 输出前t个
cout<<res[t-1].first<<" ";
int count = 0;
for(int i = 0; i < res.size(); ++i){
if(res[i].first >= res[t-1].first){
count++;
}
}
cout<<count<<endl;
for(auto &[value,key]: res){
if(value >= res[t-1].first){
cout<<key<<" "<<value<<endl;
}
}
return 0;
}