import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Scanner; import java.util.StringTokenizer; import java.util.stream.Collectors; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { static class Fans { int id; int collections; int score; Fans(int id, int likes, int collections){ this.id = id; this.collections = collections; this.score = likes + collections*2; } } public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int k = Integer.parseInt(st.nextToken()); List<Fans> fansList = new ArrayList<>(n); for(int i=0;i<n;i++){ st = new StringTokenizer(br.readLine()); Fans fans = new Fans(i+1, Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())); fansList.add(fans); } fansList.sort((f1,f2)->{ if(f1.score==f2.score){ if(f1.collections == f2.collections){ return Integer.compare(f1.id,f2.id); } return Integer.compare(f2.collections, f1.collections); } return Integer.compare(f2.score,f1.score); }); List<Fans> passedList = fansList.subList(0,k); System.out.print(passedList .stream() .sorted(Comparator.comparingInt(f->f.id)) .map(f->String.valueOf(f.id)) .collect(Collectors.joining(" "))); } }