import java.util.*;
public class Main {
static class Fan {
int support; // 支持力度 = 点赞数 + 2*收藏数
int collect; // 收藏数,用于支持力度相同时的排序
int id; // 粉丝编号
Fan(int support, int collect, int id) {
this.support = support;
this.collect = collect;
this.id = id;
}
}
public static void main(String[] args) {
// 使用Scanner接收输入
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int k = scanner.nextInt();
Fan[] fans = new Fan[n];
for (int i = 0; i < n; i++) {
int x = scanner.nextInt(); // 点赞数
int y = scanner.nextInt(); // 收藏数
// 计算支持力度并存储粉丝信息
fans[i] = new Fan(x + 2 * y, y, i + 1);
}
// 自定义排序规则
Arrays.sort(fans, (a, b) -> {
// 首先按支持力度降序排列
if (a.support != b.support) {
return Integer.compare(b.support, a.support);
}
// 支持力度相同则按收藏数降序排列
if (a.collect != b.collect) {
return Integer.compare(b.collect, a.collect);
}
// 前两者都相同则按编号升序排列
return Integer.compare(a.id, b.id);
});
// 提取前k名粉丝的编号
int[] result = new int[k];
for (int i = 0; i < k; i++) {
result[i] = fans[i].id;
}
// 按编号升序排序结果
Arrays.sort(result);
// 输出结果
StringBuilder sb = new StringBuilder();
for (int i = 0; i < k; i++) {
sb.append(result[i]);
if (i < k - 1) {
sb.append(" ");
}
}
System.out.println(sb.toString());
// 关闭Scanner
scanner.close();
}
}