'''
Created on 2020/08/26

@author: harurun
'''
def main():
  import math
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,P=map(int,pin().split())
  t=int(math.sqrt(P))+1
  if N==1:
    print(P)
    return 
  while t>0:
    s=P
    for i in range(N):
      if s%t!=0:
        break
      s=s//t
    else:
      print(t)
      return
    t-=1
  print(1)
  return 

main()