#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct Info{
    int power;
    int y;
    int i; // 编号
};
int main(){
    int n,k;
    cin>>n>>k; // n 是支持的粉丝个数,k 是要送礼的个数
    vector<Info> res;
    for(int i = 0; i < n; ++i){
        int x,y; // x 表示点赞,y 表示收藏,输入顺序就代表编号
        cin>>x>>y;
        res.push_back({x+y*2,y,i+1});
    }
    // 进行排序
    std::sort(res.begin(),res.end(),[](const auto& a,const auto& b)
    {
        if(a.power != b.power){
            return a.power > b.power;
        }else if(a.y != b.y){
            return a.y > b.y;
        }else{
            return a.i < b.i;
        }
    });
    // 输出前k个
    vector<int> result;
    for(int i = 0; i < k; ++i){
        result.push_back(res[i].i);
    }
    std::sort(result.begin(),result.end());
    for(auto &index: result){
        cout<<index<<" ";
    }
    return 0;
}