let rec floor_sqrt acc acc_x_2_x_r sq_acc_minus_z r sq_r =
  if r = 0 then acc
  else
    let sq_acc_minus_z' = sq_acc_minus_z + acc_x_2_x_r + sq_r in
    ( if sq_acc_minus_z' <= 0 then
        floor_sqrt (acc + r) ((acc_x_2_x_r lsr 1) + sq_r) sq_acc_minus_z'
      else
        floor_sqrt acc (acc_x_2_x_r lsr 1) sq_acc_minus_z) (r lsr 1) (sq_r lsr 2)
let floor_sqrt z = floor_sqrt 0 0 (~-z) (1 lsl 30) (1 lsl 60)

let () = Scanf.scanf "%d %d" @@ fun n m ->
  Printf.printf "%d\n" @@
  if n = 1 then m
  else Array.fold_left (List.fold_left max) 1 @@
    Array.init (floor_sqrt m) @@ fun i ->
      if 0 < m mod (i + 1) || m / (i + 1) < n
      then []
      else [i + 1]
