let () = Scanf.scanf "%d %d" @@ fun n m ->
  let rec solve acc i =
    if m < i * i then acc
    else solve (if 0 < m mod i || m / i < n then acc else i) (i + 1) in
  Printf.printf "%d\n" @@ if n <= 1 then m else solve 1 1
