import java.util.;
import java.io.;
public class Main{
public static void main(String[]args)throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String[] nums1 = br.readLine().split(" ");
int N = Integer.parseInt(nums1[0]);
int K = Integer.parseInt(nums1[1]);
int[] H = new int[N];
int[] W = new int[N];
for(int i = 0;i < N;i++){
String[] nums = br.readLine().split(" ");
H[i] = Integer.parseInt(nums[0]);
W[i] = Integer.parseInt(nums[1]);
}
BinarySearch(K,H,W);
}
public static int getTarget(int k,int[] H,int[] W){
int num = 0;
for(int i = 0;i < H.length;i++){
int Hmax = H[i] / k;
int Wmax = W[i] / k;
num += Hmax * Wmax;
}
return num;
}
public static int getMax(int[] H, int[] K){
int maxValue = 0;
for(int i = 0;i < H.length; i++){
if(H[i] > maxValue){
maxValue = H[i];
}
if(K[i] >maxValue){
maxValue = K[i];
}
}
return maxValue;
}
public static void BinarySearch(int target,int[] H,int[] W){
int left = 0;
int right = getMax(H,W);
while(left <= right){
int mid = left + (right - left) / 2;
if(getTarget(mid,H,W) == target){
left = mid + 1;
}else if(getTarget(mid,H,W) > target){
left = mid + 1;
}else if(getTarget(mid,H,W) < target){
right = mid - 1;
}
}
System.out.println(right);
}
}