import java.math.BigInteger;
import java.util.Scanner;

/**
 * @Author Mikhail Linkov
 * Date: 21.04.12
 */
public class ProblemE {

    private static long getDays(long x, long a, long b) {


        BigInteger x1 = BigInteger.valueOf(x);
        BigInteger a1 = BigInteger.valueOf(a);
        BigInteger b1 = BigInteger.valueOf(b);

        BigInteger count = x1.multiply(a1);
        count = count.divide(b1);
        BigInteger val = BigInteger.valueOf(1000000001);

        if (count.compareTo(val) > 0) {
            return 10000000000l;
        }

        long res = count.longValue() + 1l;

        return res;
    }

    private static final double EPS = 0.0000001;

    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        long c = scanner.nextInt();

        long [] a = new long[n];
        long [] b = new long[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextLong();
            b[i] = scanner.nextLong();
        }

        long right = 1000000000000000000l;
        long left = 1l;
        while (right - left > 1l) {
            long mid = (right + left) / 2l;
            double sum = 0;
            for (int i = 0; i < n; i++) {
                sum += getDays(mid, a[i], b[i]);
                if (sum < 0) {
                    sum = 100000000000000000d;
                }
                if (sum > c) {
                    break;
                }
            }

            if (sum >= c) {
                right = mid;
            } else {
                left = mid;
            }
        }
        double sum = 0;
        for (int i = 0; i < n; i++) {
            sum += getDays(left, a[i], b[i]);
            if (sum < 0) {
                sum = 100000000000000000d;
            }
            if (sum > c) {
                break;
            }
        }

        long LEFT = -1l;
        if (Math.abs(sum - c) <= EPS) {
            LEFT = left;
        }

        sum = 0;

        for (int i = 0; i < n; i++) {
            sum += getDays(right, a[i], b[i]);
            if (sum < 0) {
                sum = 100000000000000000d;
            }
            if (sum > c) {
                break;
            }
        }

        if (Math.abs(sum - c) <= EPS) {
            if (LEFT == -1l) {
                LEFT = right;
            }
        }

        left = 1l;
        right = 1000000000000000000l;
        while (right - left > 1l) {
            long mid = (right + left) / 2l;
            sum = 0l;
            for (int i = 0; i < n; i++) {
                sum += getDays(mid, a[i], b[i]);
                if (sum < 0) {
                    sum = 100000000000000000d;
                }
                if (sum > c) {
                    break;
                }
            }

            if (sum <= c) {
                left = mid;
            } else {
                right = mid;
            }
        }

        sum = 0;
        for (int i = 0; i < n; i++) {
            sum += getDays(right, a[i], b[i]);
            if (sum < 0) {
                sum = 100000000000000000d;
            }
            if (sum > c) {
                break;
            }
        }

        long RIGHT = -1l;
        if (Math.abs(sum - c) <= EPS) {
            RIGHT = right;
        }

        sum = 0;

        for (int i = 0; i < n; i++) {
            sum += getDays(left, a[i], b[i]);
            if (sum < 0) {
                sum = 100000000000000000d;
            }
            if (sum > c) {
                break;
            }
        }

        if (Math.abs(sum - c) <= EPS) {
            if (RIGHT == -1) {
                RIGHT = left;
            }
        }

        long answer = RIGHT - LEFT + 1l;

        if (answer == 1000000000000000000l) {
            System.out.println(-1);
            return;
        }
        if ((RIGHT == -1l) || (LEFT == -1l))  {
            System.out.println(0);
            return;
        }

        System.out.println(answer);


    }
}
