#include <bits/stdc++.h>
using namespace std;
int s[105],k[10005][105];
int main(void)
{
int n,m,ss,kk,count = 0,i,max = 0,x,j;
scanf("%d%d",&n,&m); // input
m = m * 1.5; // Number of people
for (i = 0;i < n;i++)
{
scanf("%d%d",&kk,&ss); // input
k[kk][ss]; // Included
s[ss]; // Included
}
for (i = 100;count < m;i--)
count += s[i]; // Calculate the score and the number of people who can enter
printf("%d %d\n",i + 1,count); // output
x = i + 1; // Record the score line
for(i = 100;i >= x;i--) // Enumeration from large to small within the fraction line
for(j = 1000;j <= 10000;j++) // Search name under one score
if(k[j][i]) printf("%d %d\n",j,i); // Search output
return 0;
}