import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];

    int ret;
    foreach (d; 1..(10^^5+1)) {
        if (M % d) continue;
        if (M / d < N) continue;
        ret = d;
    }

    writeln(ret);
}