//分巧克力,总算是慢慢领悟二分的思路了
include[HTML_REMOVED]
using namespace std;
const int N=1e5+10;
int n,k,hi,wi;
struct chocolate{
int w;
int h;
}chocolate[N];
bool check(int mid){
int res=0;
for(int i=0;i[HTML_REMOVED]=k;
}
int main(){
cin>>n>>k;
for(int i=0;i[HTML_REMOVED]>hi>>wi;
chocolate[i].w=wi;
chocolate[i].h=hi;
}
int l=0,r=1e5;
while(l[HTML_REMOVED]>1;
if(check(mid))l=mid;
else r=mid-1;
}
cout<<l;
return 0;
}