#include<bits/stdc++.h>
using namespace std;

using ll=long long;
using ull=unsigned long long;
using i128=__int128_t;
using u128=__uint128_t;
using ld=long double;

struct p//用结构体表示一个人 很方便
{
	int num;
	int sc;
};

bool cmp(struct p a,struct p b)//自定义比较函数
{
	if(a.sc==b.sc) return a.num<b.num;
	else return a.sc>b.sc;
}

void solve()
{
	int n,m;
	cin >> n >> m;
	vector<p>v(n);
	for(int i=0;i<n;i++)
	{
		cin >> v[i].num >> v[i].sc;
	}
	sort(v.begin(),v.end(),cmp);
	int fa=floor(1.5*m),cnt=0;
	for(int i=fa;i<n;i++)//找最低分数线的人有几个
	{
		if(v[i].sc==v[fa-1].sc) cnt++;
		else break;
	}
	cout << v[fa-1].sc << " " << fa+cnt << "\n";
	for(int i=0;i<fa+cnt;i++)
	{
		cout << v[i].num << " " << v[i].sc << "\n";
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int t=1;
	//cin >> t;
	
	while(t--)
	{
		solve();
	}
	return 0;
}