void main()
{
    long[] tmp = readln.split.to!(long[]);
    long n = tmp[0], p = tmp[1];

    long[long] lists;
    lists[2] = 0;
    while (p % 2 == 0)
    {
        ++lists[2];
        p /= 2;
    }
    for (long i = 3; i * i <= p; i += 2)
    {
        if (p % i == 0)
        {
            lists[i] = 0;
            while(p % i == 0)
            {
                ++lists[i];
                p /= i;
            }
        }
    }
    if (p > 1) lists[p] = 1;

    long g = 1;
    foreach (key, val; lists)
    {
        if (val >= n) g *= key ^^ (val / n);
    }

    g.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;