open Printf open Scanf
let divisors v = 
	let rec f0 i a =
		if i*i > v then a
		else if i*i = v && v mod i = 0 then i::a
		else if v mod i = 0 then f0 (i+1) (i::(v/i)::a)
		else f0 (i+1) a in f0 1 []
let () = scanf " %d %d" @@ fun n m -> 
	let l = m/n in
	divisors m |> List.sort compare |> List.rev
	|> List.iter @@ fun v ->
		if v <= l then (printf "%d\n" v; exit 0)