#include<iostream>
#include<cmath>
using namespace std;
int h[100000] = {0};
int w[100000] = {0};
int n, k;
int maxA = -1;
int check(int a)
{
int cnt = 0;
for(int i = 0; i < n; i++)
cnt += (h[i] / a) * (w[i] / a);
if(cnt >= k)
{
maxA = a;
return 1;
}
return 0;
}
int main()
{
cin >> n >> k;
int r = 0;
for(int i = 0; i < n; i++){
cin >> h[i] >> w[i];
int t = max(h[i], w[i]);
r = max(r, t);
}
int l = 1;
while(l <= r)
{
int mid = (l + r) / 2;
if(check(mid) == 1)
l = mid + 1;
else
r = mid - 1;
}
cout << maxA << endl;
return 0;
}