#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using i128=__int128_t;
using u128=__uint128_t;
using ld=long double;
struct fan
{
int sc;//收藏数
int all;//总支持力度
int num;//编号
};
bool cmp(fan a,fan b)//依题意的自定义比较函数
{
if(a.all==b.all)
{
if(a.sc==b.sc) return a.num<b.num;
else return a.sc>b.sc;
}
else return a.all>b.all;
}
void solve()
{
int n,k,x,y;
cin >> n >> k;
vector<fan>v(n);//存储粉丝的所有数据
vector<int>nums(k);
for(int i=0;i<n;i++)
{
cin >> x >> y;
v[i].all=x+2*y;
v[i].num=i+1;
v[i].sc=y;
}
sort(v.begin(),v.end(),cmp);
for(int i=0;i<k;i++)
{
nums[i]=v[i].num;//存储编号
}
sort(nums.begin(),nums.end());
for(int i=0;i<k;i++)//升序后输出
{
cout << nums[i] << ' ';
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t=1;
//cin >> t;
while(t--)
{
solve();
}
return 0;
}