"use strict";
function Main(input) {
    let lines = input.split("\n");
    let cols = lines.shift().split(/\s/).map((v) => v - 0);
    let N = cols[0], M = cols[1];
    let ans = 1;
    for (let A = 1; A * A <= M; A++) {
        if (M % A != 0) continue;
        let B = Math.floor(M / A);
        if (A * N <= M) ans = Math.max(ans, A);
        if (B * N <= M) ans = Math.max(ans, B);
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
