https://www.acwing.com/problem/content/1229/
#include<bits/stdc++.h>
using namespace std;
const int N= 1e5+7;
int h[N],w[N];
int n,k;
bool check(int ans)
{
int cnt=0;
for( int i=0;i<n;i++){
cnt+=(h[i]/ans)* (w[i]/ans);
//cnt+=s/(ans*ans);
}
return cnt>=k;
}
int main()
{
cin>>n>>k;
int ma=0;
for(int i=0;i<n;i++)
{
scanf("%d%d",&h[i],&w[i]);
ma=(max(h[i],ma),max(w[i],ma));
}
int r=ma,l=0;
//int mid=(r+n)/2;
while (l < r)
{
int mid = l + r + 1 >> 1;
if (check(mid)) l = mid;
else r = mid - 1;
}
// cout<<check(1361)<<endl;
cout<<l<<endl;
return 0;
}