#include<cstdio>
#include<algorithm>
using namespace std;
//直接排序,无脑水过
const int N = 50005;
struct Node{
    int fir;
    int sec;
    int pos;
} cows[N];
bool cmp1(Node &a,Node &b)
{
    if(a.fir==b.fir) return a.sec>b.sec;
    return a.fir>b.fir;
}
bool cmp2(Node &a,Node &b)
{
    if(a.sec==b.sec) return a.fir>b.fir;
    return a.sec>b.sec;
}
int main()
{
    int n,k;
    while(~scanf("%d%d",&n,&k))
    {
        for(int i = 0;i<n;++i){
            scanf("%d%d",&cows[i].fir,&cows[i].sec);
            cows[i].pos = i;
        }
        sort(cows,cows+n,cmp1);
        sort(cows,cows+k,cmp2);
        printf("%d\n",cows[0].pos+1);
    }
    return 0;
}