Imports System.Collections.Generic
Imports System.Console
Imports System.Math  
Module Program
    Function primeFactor(n As Long) As Dictionary(Of Long, Integer)
    Dim res As New Dictionary(Of Long, Integer)
        Dim i As Long = 2
        While i*i<=n 
            While (n Mod i) = 0
                If res.ContainsKey(i) Then
                    res(i) = res(i)+1
                Else
                    res.Add(i,1)
                End If
                n/=i
            End While
            i+=1
        End While
        If n <> 1 Then
                If res.ContainsKey(n) Then
                    res(n) = res(n)+1
                Else
                    res.Add(n,1)
                End If
        End If
        Return res
    End Function

 	Sub Main()
        Dim input() As String = Console.ReadLine().Split(" ")
        Dim N As Long = input(0)
        Dim P As Long  = input(1)
        Dim maxd As Long = 1
        Dim pf As Dictionary(Of Long, Integer) = primeFactor(P)
        For Each d As Long in pf.Keys
            Dim count As Integer = pf(d)
            If count >= N Then
                maxd *= d
                count -=N
            End If
        Next
        Console.WriteLine(maxd)
    End Sub
End Module
