#include <bits/stdc++.h>

using namespace std;
const int N = 5010;

struct Person {
int k;
int s;
} a[N];

bool cmp(const Person &a, const Person &b) {
if (a.s == b.s) return a.k < b.k;
return a.s > b.s;
}

int main() {
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) cin >> a[i].k >> a[i].s;

sort(a + 1, a + 1 + n, cmp);
int c = m * 1.5;
int cnt = 0;
for (int i = c + 1; i <= n; i++) {
if (a[i].s == a[c].s) cnt++;
else break;
}
c += cnt;
cout << a[c].s << " " << c << endl;
for (int i = 1; i <= c; i++) cout << a[i].k << " " << a[i].s << endl;
return 0;
}