#include<iostream>
using namespace std;
long gcd(long a,long b){return b?gcd(b,a%b):a;}
long a,b;
int main()
{
	cin>>a>>b;
	b/=gcd(a,b);
	for(long i=2;i*i<=b;i++)
	{
		while(b%(i*i)<1)b/=i;
	}
	cout<<b<<endl;
}

