#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
struct zhiyuanzhe {
int num;
int chengji;
};
bool cmp(zhiyuanzhe p1, zhiyuanzhe p2) {
if (p1.chengji != p2.chengji) {
return p1.chengji > p2.chengji;
} else {
return p1.num < p2.num;
}
}
int main() {
int n = 0, m = 0, s = 0;
int renshu = 0;
cin >> n >> m;
s = floor(m * 1.5);
zhiyuanzhe people[5000];
for (int i = 0; i < n; i++) cin >> people[i].num >> people[i].chengji;
sort(people, people + n, cmp);
for (int i = 0; i < n; i++) {
if (people[i].chengji >= people[s - 1].chengji)renshu++;
}
cout << people[s - 1].chengji << " " << renshu<<endl;
for (int i = 0; i <renshu; i++) {
cout << people[i].num << " " << people[i].chengji << endl;
}