program P1336;
var
n,m,i,j,k:longint;
a,b,c:array[1..50000] of integer;
begin
assign(input,'score.in');
reset(input);
assign(output,'score.out');
rewrite(output);
readln(n,m);
for i:=1 to n do
readln(b[i],a[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if (a[i]<a[j])or((a[i]=a[j])and(b[i]>b[j])) then begin
k:=a[i]; a[i]:=a[j]; a[j]:=k;
k:=b[i]; b[i]:=b[j]; b[j]:=k;
k:=0; end;
j:=0;
m:=trunc(m*1.5);
for i:=1 to n do
if a[i]>=a[m] then inc(j);
writeln(a[m],' ',j);
for i:=1 to n do
if a[i]>=a[m] then writeln(b[i],' ',a[i]);
end.