inputs = STDIN.readlines.map{|line|line.strip.split()}
line = inputs.shift

n = line[0].to_i
m = line[1].to_i

d = m.div(n)

while d > 0
    if m % d == 0 then
        puts(d)
        break
    end
    d -= 1
end