#include<iostream> #include<algorithm> using namespace std; struct Node{ int id,a1,a2; }vote[50005]; bool cmp(struct Node v1,struct Node v2){ return v1.a1>v2.a1; } int main(){ int n,k,ans,ansi; scanf("%d%d",&n,&k); for(int i=0;i<n;i++){ scanf("%d%d",&vote[i].a1,&vote[i].a2); vote[i].id = i+1; } sort(vote,vote+n,cmp); // for(int i=0;i<k;i++){ // cout<<vote[i].a1<<" "<<vote[i].a2<<endl; // } ans = vote[0].a2; ansi = vote[0].id; for(int i=1;i<k;i++) if(vote[i].a2>ans){ ans = vote[i].a2; ansi = vote[i].id; } printf("%d\n",ansi); return 0; }