#include <bits/stdc++.h>
using namespace std;
struct stu
{
int num;
int sco;
} s[5050];
bool cmp(stu a, stu b)
{
if (a.sco != b.sco)
return a.sco > b.sco;
return a.num < b.num;
}
int n, m;
int main()
{
cin >> n >> m;
m *= 1.5;
for (int i = 1; i <= n; i++)
{
cin >> s[i].num >> s[i].sco;
}
sort(s + 1, s + n + 1, cmp);
int f = s[m].sco;
int z = m;
while (s[z].sco == f)
z++;
cout << f << " " << z - 1 << endl;
for (int i = 1; i < z; i++)
{
cout << s[i].num << " " << s[i].sco << endl;
}
return 0;
}