require "prime"
n,m=gets.split.map(&:to_i)
# 参考：https://qiita.com/norioc/items/5c270ad6ff5d22d1efd0#comment-da13f6b749dba662ec63
def d(n)
  n.prime_division.inject([1]) do |ary, (p, e)|
    (0..e).map{ |e1| p ** e1 }.product(ary).map{ |a, b| a * b }
  end.sort
end
d(m).reverse do |i|
  if i<=m/n
    puts i
    exit
  end
end
