require 'prime'
N, M = gets.split.map(&:to_i)
pd = M.prime_division.flat_map { |(n, e)| [n] * e }.sort

INF = 1 << 60
$min = INF
def dfs(pd, i, n)
  return INF if n >= $min
  if i == pd.size
    return n < N ? INF : n
  end
  ret = [
    dfs(pd, i + 1, n),
    dfs(pd, i + 1, n * pd[i])
  ].min
  $min = ret if ret < $min
  ret
end
div = dfs(pd, 0, 1)
ans = M / div
puts ans
