import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int m = scanner.nextInt();
int t = (int) (m * 1.5);
List<Candidate> candidates = new ArrayList<>();
for (int i = 0; i < n; i++) {
int k = scanner.nextInt();
int s = scanner.nextInt();
candidates.add(new Candidate(k, s));
}
// 排序:成绩从高到低,成绩相同报名号从小到大
// Override Comparator比较器
candidates.sort((o1, o2)-> {
if (o1.score != o2.score) return o2.score - o1.score;
else return o1.id - o2.id;
});
int line = candidates.get(t - 1).score;
int cnt = 0;
List<Candidate> interviewCandidates = new ArrayList<>();
for (Candidate candidate : candidates) {
if (candidate.score >= line) {
interviewCandidates.add(candidate);
cnt++;
}
}
System.out.println(line + " " + cnt);
for (Candidate candidate : interviewCandidates) {
System.out.println(candidate.id + " " + candidate.score);
}
scanner.close();
}
}
class Candidate {
int id;
int score;
public Candidate(int id, int score) {
this.id = id;
this.score = score;
}
}