require 'prime'
N,M = gets.split.map(&:to_i)
DS = M.prime_division

def r(x,i, &f)
  if i == DS.size
    return f.call(x)
  end
  a,b = DS[i]
  (0..b).each{ |j|
    r(x*(a**j), i+1, &f)
  }
end

$ans = 1

r(1,0) { |x|
  #p x
  if M/x >= N
    $ans = [$ans, x].max
  end
}
p $ans