N,M = readline.split.map(&:to_i)

require 'prime'
primes = Prime.prime_division(M)

$max = 1
def find_largest(primes, i, x)
  if i>=primes.size
    $max = x if x > $max
  else
    b,emax = primes[i]
    #pp primes, i, emax
    (0..emax).each do |e|
      div = x * (b**e)
      #pp "div: #{div}, i:#{i} e:#{e}"
      break if div > M/N
      find_largest(primes, i+1, div)
    end
  end
end

find_largest(primes, 0, 1)
puts $max
