#!/usr/bin/env ruby

(n, p) = gets.chomp.split(/ /).map(&:to_i)
array = []
if (n == 1)
  puts p
  exit
end

if (p == 1)
  puts 1
  exit
end

i = 2
while (p > 1 || i * i <= n)
  if (p % i == 0)
    if ((p % (i ** n)) == 0)
      array << i
      p /= i ** n
    else
      p /= i
    end
  else
    i += 1
  end
end
r = array.inject(1){|res, m|res * m}
puts r
