#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m) {
vector<pair<int, int>> infor(n);
int k, s;//k 是 报名号,s 是笔试成绩
for (int i = 0; i < n; ++i) {
cin >> k >> s;
infor.emplace_back(k,
s);//直接在容器的内存空间里 “就地” 创建元素,省去拷贝 / 移动的开销。
}
sort(infor.begin(), infor.end(), [](const auto & a, const auto & b) {
return a.second == b.second ? a.first<b.first: a.second>b.second;
}); //按第二列降序排序,若第二列值相等,按第一列升序
int num = floor(m * 1.5);
int score_line = infor[num - 1].second;
int cnt = 0;
for (auto& i : infor) {
if (i.second >= score_line)
++cnt;
}
cout << score_line << " " << cnt << endl;
for (int j = 0; j < cnt; ++j) {
cout << infor[j].first << " " << infor[j].second << endl;
}
}
return 0;
}