import sys
import math

while True:
    try:
        n, m = map(int, input().split())
        ans = {}
        while n:
            k, s = map(int, input().split())
            ans[k] = s
            n = n - 1
        # 向上取整 获取进面人数 target
        target = math.floor(m * 1.5)
        # 按照成绩降序,报名号升序排
        sorted_ans = sorted(ans.items(), key=lambda x: (-x[1], x[0]))
        # 确定分数线 此时[(1422, 95), (8805, 95), (9848, 90), (4162, 88), (6731, 88), (7483, 84)]
        line_score = sorted_ans[target - 1][1]  # 注意取[1]因为要分数即元组中第二个
        final_list = [item for item in sorted_ans if item[1] >= line_score]

        print(line_score, len(final_list))
        for k, s in final_list:
            print(f"{k} {s}")

        # 重点:字典相关题目应该转成列表会更好做,比如按位置访问,排序,切片,都是列表方便

    except:
        break