/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //puts("") ;
            for(ll j=tmp ; ; j+=tmp){
                bool flag = false ;
                ll x=1,b=k,c=j ;
                while(b){
                    if(c*x>mx*mx) {flag=true;break;}
                    if(b&1) x = x*c ;
                    if(c>1e5 && b){flag=true;break;}
                    c = c*c ;
                    b >>= 1 ;
                    //debug2(x,c) ;
                }
                if(flag==true) break ;
                if(x/i>mx) break ;
                //debug2(i,x) ;

                if(x%i==0){
                    if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                    else ans += cnt[i]*cnt[x/i] ;
                }
            }
            //debug(ans) ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //puts("") ;
            for(ll j=tmp ; ; j+=tmp){
                bool flag = false ;
                ll x=1,b=k,c=j ;
                while(b){
                    if(c*x>1e10+20) {flag=true;break;}
                    if(b&1) x = x*c ;
                    if(c>1e5 && b){flag=true;break;}
                    c *= c ;
                    b >>= 1 ;
                    //debug2(x,c) ;
                }
                if(flag==true) break ;
                if(x/i>mx) break ;
                //debug2(i,x) ;

                if(x%i==0){
                    if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                    else ans += cnt[i]*cnt[x/i] ;
                }
            }
            //debug(ans) ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        int mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            int x ;
            scanf("%d",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(int i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //debug(tmp) ;
            for(int j=tmp ; ; j+=tmp){
                ll x = qpow(j,k) ;
                if(x>mx*mx) break ;
                //debug(x) ;
                if(x%i==0){
                    if(x/i==i){
                        ans += cnt[i]*(cnt[i]-1) ;
                    } else {
                        ans += cnt[i]*cnt[x/i] ;
                    }
                }
            }
            //cout << i << ' ' << ans << endl ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

ll p[maxn][200] ;

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins

        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        for(ll i=1 ; i<=100000 ; i++){
            p[i][0] = 1 ;
            for(int j=1 ; j<=100 ; j++){
                if(p[i][j-1]==-1) p[i][j] = -1 ;
                else p[i][j] = p[i][j-1]*i ;
                if(p[i][j]>mx*mx) p[i][j] = -1 ;
            }
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;

            for(ll j=tmp ;  ; j+=tmp){
                //debug2(j,p[j][k]) ;
                if(j>100000) break ;
                if(p[j][k]==-1) break ;
                ll x = p[j][k] ;
                if(x%i) continue ;
                if(x/i>mx) break ;
                if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                else ans += cnt[i]*(cnt[x/i]) ;
            }
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(int i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //debug(tmp) ;
            for(ll j=tmp ; ; j+=tmp){
                ll x = qpow(j,k) ;
                if(x>mx*mx) break ;
                //debug(x) ;
                if(x%i==0){
                    if(x/i>mx) continue ;
                    if(x/i==i){
                        ans += cnt[i]*(cnt[i]-1) ;
                    } else {
                        ans += cnt[i]*cnt[x/i] ;
                    }
                }
            }
            //cout << i << ' ' << ans << endl ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //puts("") ;
            for(ll j=tmp ; ; j+=tmp){
                bool flag = false ;
                ll x=1,b=k,c=j ;
                while(b){
                    if(c*c/c!=c || c*x/x!=c || sqrt(c*x)>mx) {flag=true;break;}
                    if(b&1) x = x*c ;
                    c = c*c ;
                    b >>= 1 ;
                    //debug2(x,c) ;
                }
                if(flag==true) break ;
                if(sqrt(x)>mx) break ;
                if(x/i>mx) break ;
                //debug2(i,x) ;

                if(x%i==0){
                    if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                    else ans += cnt[i]*(cnt[x/i]) ;
                }
            }
            //debug(ans) ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(int i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //debug(tmp) ;
            for(ll j=tmp ; ; j+=tmp){
                ll x = 1 ;
                ll b = k ;
                ll c = j ;
                while(b){
                    if(b&1) x *= c ;
                    c *= c ;
                    if(x>1e10+20) break ;
                    if(c>1e10+20) break ;
                    b >>= 1 ;
                }
                if(x>1e10+20) break ;
                if(c>1e10+20) break ;
                //debug(x) ;
                if(x%i==0){
                    if(x/i>mx) continue ;
                    if(x/i==i){
                        ans += cnt[i]*(cnt[i]-1) ;
                    } else {
                        ans += cnt[i]*cnt[x/i] ;
                    }
                }
            }
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            int x ;
            scanf("%d",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(int i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //debug(tmp) ;
            for(int j=tmp ; ; j+=tmp){
                ll x = qpow(j,k) ;
                if(x>mx*mx) break ;
                //debug(x) ;
                if(x%i==0){
                    if(x/i==i){
                        ans += cnt[i]*(cnt[i]-1) ;
                    } else {
                        ans += cnt[i]*cnt[x/i] ;
                    }
                }
            }
            //cout << i << ' ' << ans << endl ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(int i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //debug(tmp) ;
            for(int j=tmp ; ; j+=tmp){
                ll x = qpow(j,k) ;
                if(x>mx*mx) break ;
                //debug(x) ;
                if(x%i==0){
                    if(x/i>mx) continue ;
                    if(x/i==i){
                        ans += cnt[i]*(cnt[i]-1) ;
                    } else {
                        ans += cnt[i]*cnt[x/i] ;
                    }
                }
            }
            //cout << i << ' ' << ans << endl ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(int i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //debug(tmp) ;
            for(int j=tmp ; ; j+=tmp){
                ll x = qpow(j,k) ;
                if(x>mx*mx) break ;
                //debug(x) ;
                if(x%i==0){
                    if(x/i==i){
                        ans += cnt[i]*(cnt[i]-1) ;
                    } else {
                        ans += cnt[i]*cnt[x/i] ;
                    }
                }
            }
            //cout << i << ' ' << ans << endl ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //puts("") ;
            for(ll j=tmp ; ; j+=tmp){
                bool flag = false ;
                ll x=1,b=k,c=j ;
                while(b){
                    if(c>1e5 || c*x>mx*mx) {flag=true;break;}
                    if(b&1) x = x*c ;
                    c = c*c ;
                    b >>= 1 ;
                    //debug2(x,c) ;
                }
                if(flag==true) break ;
                if(x/i>mx) break ;
                //debug2(i,x) ;

                if(x%i==0){
                    if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                    else ans += cnt[i]*cnt[x/i] ;
                }
            }
            //debug(ans) ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //puts("") ;
            for(ll j=tmp ; ; j+=tmp){
                bool flag = false ;
                ll x=1,b=k,c=j ;
                while(b){
                    if(c*c/c!=c || c*x/x!=c || c*x>mx*mx) {flag=true;break;}
                    if(b&1) x = x*c ;
                    c = c*c ;
                    b >>= 1 ;
                    //debug2(x,c) ;
                }
                if(flag==true) break ;
                if(x>mx*mx) break ;
                //debug2(i,x) ;

                if(x%i==0){
                    if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                    else ans += cnt[i]*(cnt[x/i]) ;
                }
            }
            //debug(ans) ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

ll p[maxn][200] ;

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins

        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        for(ll i=1 ; i<=100000 ; i++){
            p[i][0] = 1 ;
            for(int j=1 ; j<=100 ; j++){
                if(p[i][j-1]==-1) p[i][j] = -1 ;
                else p[i][j] = p[i][j-1]*i ;
                if(p[i][j]>mx*mx) p[i][j] = -1 ;
            }
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;

            for(ll j=tmp ;  ; j+=tmp){
                //debug2(j,p[j][k]) ;
                if(p[j][k]==-1) break ;
                ll x = p[j][k] ;
                if(x%i) continue ;
                if(x/i>mx) break ;
                if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                else ans += cnt[i]*(cnt[x/i]) ;
            }
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //puts("") ;
            for(ll j=tmp ; ; j+=tmp){
                bool flag = false ;
                ll x=1,b=k,c=j ;
                while(b){
                    if(c*x>mx*mx) {flag=true;break;}
                    if(b&1) x = x*c ;
                    c = c*c ;
                    b >>= 1 ;
                    if(c>1e5 && b){flag==true;break;}
                    //debug2(x,c) ;
                }
                if(flag==true) break ;
                if(x/i>mx) break ;
                //debug2(i,x) ;

                if(x%i==0){
                    if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                    else ans += cnt[i]*cnt[x/i] ;
                }
            }
            //debug(ans) ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //puts("") ;
            for(ll j=tmp ; ; j+=tmp){
                bool flag = false ;
                ll x=1,b=k,c=j ;
                while(b){
                    if(c*c/c!=c || c*x/x!=c || c*x>mx*mx) {flag=true;break;}
                    if(b&1) x = x*c ;
                    c = c*c ;
                    b >>= 1 ;
                    //debug2(x,c) ;
                }
                if(flag==true) break ;
                if(x>mx*mx) break ;
                if(x/i>mx) break ;
                //debug2(i,x) ;

                if(x%i==0){
                    if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                    else ans += cnt[i]*(cnt[x/i]) ;
                }
            }
            //debug(ans) ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //puts("") ;
            for(ll j=tmp ; ; j+=tmp){
                bool flag = false ;
                ll x=1,b=k,c=j ;
                while(b){
                    if(c*x>1e10+20) {flag=true;break;}
                    if(b&1) x = x*c ;
                    if(c>1e9 && b){flag=true;break;}
                    c *= c ;
                    b >>= 1 ;
                    //debug2(x,c) ;
                }
                if(flag==true) break ;
                if(x/i>mx) break ;
                //debug2(i,x) ;

                if(x%i==0){
                    if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                    else ans += cnt[i]*cnt[x/i] ;
                }
            }
            //debug(ans) ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(int i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //debug(tmp) ;
            for(ll j=tmp ; ; j+=tmp){
                ll x = 1 ;
                ll b = k ;
                ll c = j ;
                while(b){
                    if(b&1) x *= c ;
                    c *= c ;
                    if(x>mx*mx) break ;
                    b >>= 1 ;
                }
                if(x>mx*mx) break ;
                //debug(x) ;
                if(x%i==0){
                    if(x/i>mx) continue ;
                    if(x/i==i){
                        ans += cnt[i]*(cnt[i]-1) ;
                    } else {
                        ans += cnt[i]*cnt[x/i] ;
                    }
                }
            }
            //cout << i << ' ' << ans << endl ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(int i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //debug(tmp) ;
            for(ll j=tmp ; ; j+=tmp){
                ll x = 1 ;
                ll b = k ;
                ll c = j ;
                while(b){
                    if(b&1) x *= c ;
                    c *= c ;
                    if(c>mx*mx) break ;
                    if(x>mx*mx) break ;
                    b >>= 1 ;
                }
                if(x>mx*mx) break ;
                //debug(c) ;
                if(c>1e10+20) continue ;
                //debug(x) ;
                if(x%i==0){
                    if(x/i>mx) continue ;
                    if(x/i==i){
                        ans += cnt[i]*(cnt[i]-1) ;
                    } else {
                        ans += cnt[i]*cnt[x/i] ;
                    }
                }
            }
            //cout << i << ' ' << ans << endl ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(int i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //debug(tmp) ;
            for(ll j=tmp ; ; j+=tmp){
                ll x = 1 ;
                ll b = k ;
                ll c = j ;
                while(b){
                    if(b&1) x *= c ;
                    c *= c ;
                    if(c>mx*mx) break ;
                    if(x>mx*mx) break ;
                    b >>= 1 ;
                }
                if(c>mx*mx) break ;
                if(x>mx*mx) break ;
                //debug(x) ;
                if(x%i==0){
                    if(x/i>mx) continue ;
                    if(x/i==i){
                        ans += cnt[i]*(cnt[i]-1) ;
                    } else {
                        ans += cnt[i]*cnt[x/i] ;
                    }
                }
            }
            //cout << i << ' ' << ans << endl ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}


#include <bits/stdc++.h>

using namespace std;
bool prime[100010];
long long n;
long long k;
long long a[100010];
long long cnt[100010];
vector<long long>primes;
long long power(long long x,long long y)
{
    if(y==0)
    return 1;
    if(y%2==0)
    return power(x,y/2)*power(x,y/2);
    return x*power(x,y-1);
}

int main(){

for(int i=2;i<100010;i++)
prime[i]=true;
for(int i=2;i<100010;i++)
if(prime[i])
for(int j=2;j*i<100010;j++)
prime[i*j]=false;
for(int i=0;i<100010;i++)
if(prime[i])
primes.push_back(i);

cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];

for(int i=0;i<n;i++)
{
    long long d=1;
    for(int j=0;j<primes.size();j++)
    {
        if(prime[a[i]])
        {d*=a[i];
        break;}
        long long p=primes[j];
        long long c=0;
        while(a[i]%p==0)
        {
            c++;
            a[i]/=p;
        }
        d*=power(p,c%k);

    }
    a[i]=d;
}
 for(int i=0;i<n;i++)
 cnt[a[i]]++;
 long long ans=0;
 for(int i=0;i<n;i++)
 {
     long long d=1;
     for(int j=0;j<primes.size();j++)
     {
         if(prime[a[i]])
         {
             d*=a[i];
             if(d>=100010)
             d=0;
             break;
         }
         long long p=primes[i];
     long long c=0;
     while(a[i]%p==0)
     {
         c++;
         a[i]/=p;
     }
     c=(k-c)%k;
      while(c--)
      {
          d*=p;
          if(d>=100010)
          d=0;
      }

     }
ans+=cnt[d];

 }
 cout<<(ans-n)/2;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
bool prime[100010];
long long n;
long long k;
long long a[100010];
long long cnt[100010];
vector<long long>primes;
long long power(long long x,long long y)
{
    if(y==0)
    return 1;
    if(y%2==0)
    return power(x,y/2)*power(x,y/2);
    return x*power(x,y-1);
}

int main(){

for(int i=2;i<100010;i++)
prime[i]=true;
for(int i=2;i<100010;i++)
if(prime[i])
for(int j=2;j*i<100010;j++)
prime[i*j]=false;
for(int i=0;i<100010;i++)
if(prime[i])
primes.push_back(i);

cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];

for(int i=0;i<n;i++)
{
    long long d=1;
    for(int j=0;j<primes.size();j++)
    {
        if(prime[a[i]])
        {d*=a[i];
        break;}
        long long p=primes[j];
        long long c=0;
        while(a[i]%p==0)
        {
            c++;
            a[i]/=p;
        }
        d*=power(p,c%k);

    }
    a[i]=d;
}
 for(int i=0;i<n;i++)
 cnt[a[i]]++;
 long long ans=0;
 for(int i=0;i<n;i++)
 {
     long long d=1;
     for(int j=0;j<primes.size();j++)
     {
         if(prime[a[i]])
         {
             d*=a[i];
             if(d>=100010)
             d=0;
             break;
         }
         long long p=primes[i];
     long long c=0;
     while(a[i]%p==0)
     {
         c++;
         a[i]/=p;
     }
     c=(k-c)%k;
      while(c--)
      {
          d*=p;
          if(d>=100010)
          d=0;
      }

     }

ans+=cnt[d]-(d==a[i]);

 }

 cout<<ans/2;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
bool prime[100010];
long long n;
long long k;
long long a[100010];
long long cnt[100010];
vector<long long>primes;
long long power(long long x,long long y)
{
    if(y==0)
    return 1;
    if(y%2==0)
    return power(x,y/2)*power(x,y/2);
    return x*power(x,y-1);
}

int main(){

for(int i=2;i<100010;i++)
prime[i]=true;
for(int i=2;i<100010;i++)
if(prime[i])
for(int j=2;j*i<100010;j++)
prime[i*j]=false;
for(int i=0;i<100010;i++)
if(prime[i])
primes.push_back(i);

cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];

for(int i=0;i<n;i++)
{

    long long d=1;
    for(int j=0;j<primes.size();j++)
    {
        if(prime[a[i]])
        {d*=a[i];
        break;}
        long long p=primes[j];
        long long c=0;
        while(a[i]%p==0)
        {
            c++;
            a[i]/=p;
        }
        d*=power(p,c%k);

    }
    a[i]=d;
}
 for(int i=0;i<n;i++)
 cnt[a[i]]++;
 long long ans=0;

 for(int i=0;i<n;i++)
 {
     long long u=a[i];
     long long d=1;

     for(int j=0;j<primes.size();j++)
     {
         if(prime[a[i]])
         {

             for(int e=0;e<k-1;e++)
             {d*=a[i];
             if(d>=100010)
             d=0;}
             break;
         }
         long long p=primes[j];
     long long c=0;
     while(a[i]%p==0)
     {
         c++;
         a[i]/=p;
     }
     c=(k-c)%k;
      while(c--)
      {
          d*=p;
          if(d>=100010)
          d=0;
      }

     }

ans+=cnt[d]-(d==u);

 }

 cout<<ans/2;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
bool prime[100010];
long long n;
long long k;
long long a[100010];
long long cnt[100010];
vector<long long>primes;
long long power(long long x,long long y)
{
    if(y==0)
    return 1;
    if(y%2==0)
    return power(x,y/2)*power(x,y/2);
    return x*power(x,y-1);
}

int main(){

for(int i=2;i<100010;i++)
prime[i]=true;
for(int i=2;i<100010;i++)
if(prime[i])
for(int j=2;j*i<100010;j++)
prime[i*j]=false;
for(int i=0;i<100010;i++)
if(prime[i])
primes.push_back(i);

cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];

for(int i=0;i<n;i++)
{

    long long d=1;
    for(int j=0;j<primes.size();j++)
    {
        if(prime[a[i]])
        {d*=a[i];
        break;}
        long long p=primes[j];
        long long c=0;
        while(a[i]%p==0)
        {
            c++;
            a[i]/=p;
        }
        d*=power(p,c%k);

    }
    a[i]=d;
}
 for(int i=0;i<n;i++)
 cnt[a[i]]++;
 long long ans=0;
 for(int i=0;i<n;i++)
 {
     long long u=a[i];
     long long d=1;
     for(int j=0;j<primes.size();j++)
     {
         if(prime[a[i]])
         {
             for(int e=0;e<k-1;e++)
             {d*=a[i];
             if(d>=100010)
             d=0;}
             break;
         }
         long long p=primes[i];
     long long c=0;
     while(a[i]%p==0)
     {
         c++;
         a[i]/=p;
     }
     c=(k-c)%k;
      while(c--)
      {
          d*=p;
          if(d>=100010)
          d=0;
      }

     }

ans+=cnt[d]-(d==u);

 }

 cout<<ans/2;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
bool prime[100010];
long long n;
long long k;
long long a[100010];
long long cnt[100010];
vector<long long>primes;
long long power(long long x,long long y)
{
    if(y==0)
    return 1;
    if(y%2==0)
    return power(x,y/2)*power(x,y/2);
    return x*power(x,y-1);
}

int main(){

for(int i=2;i<100010;i++)
prime[i]=true;
for(int i=2;i<100010;i++)
if(prime[i])
for(int j=2;j*i<100010;j++)
prime[i*j]=false;
for(int i=0;i<100010;i++)
if(prime[i])
primes.push_back(i);

cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];

for(int i=0;i<n;i++)
{

    long long d=1;
    for(int j=0;j<primes.size();j++)
    {
        if(a[i]==1)
        break;
        if(prime[a[i]])
        {d*=a[i];
        break;}
        long long p=primes[j];
        long long c=0;
        while(a[i]%p==0)
        {
            c++;
            a[i]/=p;
        }
        d*=power(p,c%k);

    }
    a[i]=d;
}
 for(int i=0;i<n;i++)
 cnt[a[i]]++;
 long long ans=0;

 for(int i=0;i<n;i++)
 {
     long long u=a[i];
     long long d=1;

     for(int j=0;j<primes.size();j++)
     {
         if(prime[a[i]])
         {

             for(int e=0;e<k-1;e++)
             {d*=a[i];
             if(d>=100010)
             d=0;}
             break;
         }
         long long p=primes[j];
     long long c=0;
     while(a[i]%p==0)
     {
         c++;
         a[i]/=p;
     }
     c=(k-c)%k;
      while(c--)
      {
          d*=p;
          if(d>=100010)
          {d=0;
          break;}
      }

     }

ans+=cnt[d]-(d==u);

 }

 cout<<ans/2;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
bool prime[100010];
long long n;
long long k;
long long a[100010];
long long cnt[100010];
vector<long long>primes;
long long power(long long x,long long y)
{
    if(y==0)
    return 1;
    if(y%2==0)
    return power(x,y/2)*power(x,y/2);
    return x*power(x,y-1);
}

int main(){

for(int i=2;i<100010;i++)
prime[i]=true;
for(int i=2;i<100010;i++)
if(prime[i])
for(int j=2;j*i<100010;j++)
prime[i*j]=false;
for(int i=0;i<100010;i++)
if(prime[i])
primes.push_back(i);

cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];

for(int i=0;i<n;i++)
{

    long long d=1;
    for(int j=0;j<primes.size();j++)
    {
        if(prime[a[i]])
        {d*=a[i];
        break;}
        long long p=primes[j];
        long long c=0;
        while(a[i]%p==0)
        {
            c++;
            a[i]/=p;
        }
        d*=power(p,c%k);

    }
    a[i]=d;
}
 for(int i=0;i<n;i++)
 cnt[a[i]]++;
 long long ans=0;

 for(int i=0;i<n;i++)
 {
     long long u=a[i];
     long long d=1;

     for(int j=0;j<primes.size();j++)
     {
         if(prime[a[i]])
         {

             for(int e=0;e<k-1;e++)
             {d*=a[i];
             if(d>=100010)
             d=0;}
             break;
         }
         long long p=primes[j];
     long long c=0;
     while(a[i]%p==0)
     {
         c++;
         a[i]/=p;
     }
     c=(k-c)%k;
      while(c--)
      {
          d*=p;
          if(d>=100010)
          {d=0;
          break;}
      }

     }

ans+=cnt[d]-(d==u);

 }

 cout<<ans/2;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
bool prime[100010];
long long n;
long long k;
long long a[100010];
long long cnt[100010];
vector<long long>primes;
long long power(long long x,long long y)
{
    if(y==0)
    return 1;
    if(y%2==0)
    return power(x,y/2)*power(x,y/2);
    return x*power(x,y-1);
}

int main(){

for(int i=2;i<100010;i++)
prime[i]=true;
for(int i=2;i<100010;i++)
if(prime[i])
for(int j=2;j*i<100010;j++)
prime[i*j]=false;
for(int i=0;i<100010;i++)
if(prime[i])
primes.push_back(i);

cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];

for(int i=0;i<n;i++)
{
    long long d=1;
    for(int j=0;j<primes.size();j++)
    {
        if(prime[a[i]])
        {d*=a[i];
        break;}
        long long p=primes[j];
        long long c=0;
        while(a[i]%p==0)
        {
            c++;
            a[i]/=p;
        }
        d*=power(p,c%k);

    }
    a[i]=d;
}
 for(int i=0;i<n;i++)
 cnt[a[i]]++;
 long long ans=0;
for(int i=0;i<n;i++)
 for(int i=0;i<n;i++)
 {
     long long d=1;
     for(int j=0;j<primes.size();j++)
     {
         if(prime[a[i]])
         {
             for(int e=0;e<k-1;e++)
             {d*=a[i];
             if(d>=100010)
             d=0;}
             break;
         }
         long long p=primes[i];
     long long c=0;
     while(a[i]%p==0)
     {
         c++;
         a[i]/=p;
     }
     c=(k-c)%k;
      while(c--)
      {
          d*=p;
          if(d>=100010)
          d=0;
      }

     }
ans+=cnt[d]-(d==a[i]);

 }

 cout<<ans/2;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
bool prime[100010];
long long n;
long long k;
long long a[100010];
long long cnt[100010];
vector<long long>primes;
long long power(long long x,long long y)
{
    if(y==0)
    return 1;
    if(y%2==0)
    return power(x,y/2)*power(x,y/2);
    return x*power(x,y-1);
}

int main(){

for(int i=2;i<100010;i++)
prime[i]=true;
for(int i=2;i<100010;i++)
if(prime[i])
for(int j=2;j*i<100010;j++)
prime[i*j]=false;
for(int i=0;i<100010;i++)
if(prime[i])
primes.push_back(i);

cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];

for(int i=0;i<n;i++)
{

    long long d=1;
    for(int j=0;j<primes.size();j++)
    {
        if(a[i]==1)
        break;
        if(prime[a[i]])
        {d*=a[i];
        break;}
        long long p=primes[j];
        long long c=0;
        while(a[i]%p==0)
        {
            c++;
            a[i]/=p;
        }
        d*=power(p,c%k);

    }
    a[i]=d;
}
 for(int i=0;i<n;i++)
 cnt[a[i]]++;
 long long ans=0;

 for(int i=0;i<n;i++)
 {
     long long u=a[i];
     long long d=1;

     for(int j=0;j<primes.size();j++)
     {
         if(a[i]==1)
         break;
         if(prime[a[i]])
         {

             for(int e=0;e<k-1;e++)
             {d*=a[i];
             if(d>=100010)
             d=0;}
             break;
         }
         long long p=primes[j];
     long long c=0;
     while(a[i]%p==0)
     {
         c++;
         a[i]/=p;
     }
     c=(k-c)%k;
      while(c--)
      {
          d*=p;
          if(d>=100010)
          {d=0;
          break;}
      }

     }

ans+=cnt[d]-(d==u);

 }

 cout<<ans/2;
    return 0;
}


/****************************
* Author : 水娃             *
* Date : 2019-10-27-15.19   *
****************************/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
#define mst(a,b) memset(a,b,sizeof(a))
#define ll long long
#define debug(a) cout<<#a<<" is "<<a<<"\n"
const int MAXN=(int)2e5+10;
const int mo=(int)1e9+7;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
int a[110000];
typedef pair<ll,int> pli;
namespace pollard_rho{
    const int C=2307;
    const int S=10;
    mt19937_64 rd(time(0));
    vector<ll>ve;
    ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
    ll mul(ll a,ll b,ll mod){return (a*b-(ll)(a/(long double)mod*b+1e-3)*mod+mod)%mod;}
    ll power(ll a,ll b,ll mod){
        ll res=1;a%=mod;
        while(b){
            if(b&1)res=mul(res,a,mod);
            a=mul(a,a,mod);
            b>>=1;
        }
        return res;
    }
    bool check(ll a,ll n){
        ll m=n-1,x,y;
        int j=0;
        while(!(m&1))m>>=1,j++;
        x=power(a,m,n);
        for(int i=1;i<=j;x=y,i++){
            y=mul(x,x,n);
            if(y==1&&x!=1&&x!=n-1)return 1;
        }
        return y!=1;
    }
    bool miller_rabin(ll n){
        ll a;
        if(n==1)return 0;
        if(n==2)return 1;
        if(!(n&1))return 0;
        for(int i=0;i<S;i++)if(check(rd()%(n-1)+1,n))return 0;
        return 1;
    }
    ll pollard_rho(ll n,int c){
        ll i=1,k=2,x=rd()%n,y=x,d;
        while(1){
            i++;x=(mul(x,x,n)+c)%n,d=gcd(y-x,n);
            if(d>1&&d<n)return d;
            if(y==x)return n;
            if(i==k)y=x,k<<=1;
        }
    }
    void findfac(ll n,int c){
        if(n==1)return ;
        if(miller_rabin(n)){
            ve.push_back(n);
            return ;
        }
        ll m=n;
        while(m==n)m=pollard_rho(n,c--);
        findfac(m,c);
        findfac(n/m,c);
    }
    vector<pli> solve(ll n){
        vector<pli>res;
        ve.clear();
        findfac(n,C);
        sort(ve.begin(),ve.end());
        for(auto x:ve){
            if(res.empty()||res.back().first!=x)res.push_back({x,1});
            else res.back().second++;
        }
        return res;
    }
}
vector<pli>ans[110000];
int tag[110000];
map<int,int>mp;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,k,tmp;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        ans[i]=pollard_rho::solve(a[i]);
        tmp=1;
        for(int j=0;j<ans[i].size();j++)
        {
            ans[i][j].second=ans[i][j].second%k;
            for(int l=0;l<ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
            }
        }
        mp[tmp]++;
        a[i]=tmp;
    }
    ll fin=0;
    for(int i=1;i<=n;i++)
    {
        if(tag[a[i]])continue;
        tag[a[i]]=1;
        tmp=1;
        for(int j=0;j<ans[i].size();j++)
        {
            if(!ans[i][j].second)continue;
            for(int l=0;l<k-ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
            }
        }
        if(tmp>100000)continue;
        tag[tmp]=1;
        if(a[i]==tmp)fin+=mp[a[i]]*(mp[a[i]]-1)/2;
        else fin+=mp[a[i]]*mp[tmp];
    }
    cout<<fin<<"\n";
    return 0;
}


/****************************
* Author : 水娃             *
* Date : 2019-10-27-15.19   *
****************************/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
#define mst(a,b) memset(a,b,sizeof(a))
#define ll long long
#define debug(a) cout<<#a<<" is "<<a<<"\n"
const int MAXN=(int)2e5+10;
const int mo=(int)1e9+7;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
int a[110000];
typedef pair<ll,int> pli;
namespace pollard_rho{
    const int C=2307;
    const int S=10;
    mt19937_64 rd(time(0));
    vector<ll>ve;
    ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
    ll mul(ll a,ll b,ll mod){return (a*b-(ll)(a/(long double)mod*b+1e-3)*mod+mod)%mod;}
    ll power(ll a,ll b,ll mod){
        ll res=1;a%=mod;
        while(b){
            if(b&1)res=mul(res,a,mod);
            a=mul(a,a,mod);
            b>>=1;
        }
        return res;
    }
    bool check(ll a,ll n){
        ll m=n-1,x,y;
        int j=0;
        while(!(m&1))m>>=1,j++;
        x=power(a,m,n);
        for(int i=1;i<=j;x=y,i++){
            y=mul(x,x,n);
            if(y==1&&x!=1&&x!=n-1)return 1;
        }
        return y!=1;
    }
    bool miller_rabin(ll n){
        ll a;
        if(n==1)return 0;
        if(n==2)return 1;
        if(!(n&1))return 0;
        for(int i=0;i<S;i++)if(check(rd()%(n-1)+1,n))return 0;
        return 1;
    }
    ll pollard_rho(ll n,int c){
        ll i=1,k=2,x=rd()%n,y=x,d;
        while(1){
            i++;x=(mul(x,x,n)+c)%n,d=gcd(y-x,n);
            if(d>1&&d<n)return d;
            if(y==x)return n;
            if(i==k)y=x,k<<=1;
        }
    }
    void findfac(ll n,int c){
        if(n==1)return ;
        if(miller_rabin(n)){
            ve.push_back(n);
            return ;
        }
        ll m=n;
        while(m==n)m=pollard_rho(n,c--);
        findfac(m,c);
        findfac(n/m,c);
    }
    vector<pli> solve(ll n){
        vector<pli>res;
        ve.clear();
        findfac(n,C);
        sort(ve.begin(),ve.end());
        for(auto x:ve){
            if(res.empty()||res.back().first!=x)res.push_back({x,1});
            else res.back().second++;
        }
        return res;
    }
}
vector<pli>ans[110000];
int tag[110000];
map<int,int>mp;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,k,tmp;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        ans[i]=pollard_rho::solve(a[i]);
        tmp=1;
        for(int j=0;j<ans[i].size();j++)
        {
            ans[i][j].second=ans[i][j].second%k;
            for(int l=0;l<ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
            }
        }
        mp[tmp]++;
        a[i]=tmp;
    }
    ll fin=0;
    for(int i=1;i<=n;i++)
    {
        if(tag[a[i]])continue;
        tag[a[i]]=1;
        tmp=1;
        for(int j=0;j<ans[i].size();j++)
        {
            if(!ans[i][j].second)continue;
            for(int l=0;l<k-ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
            }
        }
        if(tmp>100000||tmp<0)continue;
        tag[tmp]=1;
        if(a[i]==tmp)fin+=mp[a[i]]*(mp[a[i]]-1)/2;
        else fin+=mp[a[i]]*mp[tmp];
    }
    cout<<fin<<"\n";
    return 0;
}


/****************************
* Author : 水娃             *
* Date : 2019-10-27-15.19   *
****************************/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
#define mst(a,b) memset(a,b,sizeof(a))
#define ll long long
#define debug(a) cout<<#a<<" is "<<a<<"\n"
const int MAXN=(int)2e5+10;
const int mo=(int)1e9+7;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
int a[110000];
typedef pair<ll,int> pli;
namespace pollard_rho{
    const int C=2307;
    const int S=10;
    mt19937_64 rd(time(0));
    vector<ll>ve;
    ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
    ll mul(ll a,ll b,ll mod){return (a*b-(ll)(a/(long double)mod*b+1e-3)*mod+mod)%mod;}
    ll power(ll a,ll b,ll mod){
        ll res=1;a%=mod;
        while(b){
            if(b&1)res=mul(res,a,mod);
            a=mul(a,a,mod);
            b>>=1;
        }
        return res;
    }
    bool check(ll a,ll n){
        ll m=n-1,x,y;
        int j=0;
        while(!(m&1))m>>=1,j++;
        x=power(a,m,n);
        for(int i=1;i<=j;x=y,i++){
            y=mul(x,x,n);
            if(y==1&&x!=1&&x!=n-1)return 1;
        }
        return y!=1;
    }
    bool miller_rabin(ll n){
        ll a;
        if(n==1)return 0;
        if(n==2)return 1;
        if(!(n&1))return 0;
        for(int i=0;i<S;i++)if(check(rd()%(n-1)+1,n))return 0;
        return 1;
    }
    ll pollard_rho(ll n,int c){
        ll i=1,k=2,x=rd()%n,y=x,d;
        while(1){
            i++;x=(mul(x,x,n)+c)%n,d=gcd(y-x,n);
            if(d>1&&d<n)return d;
            if(y==x)return n;
            if(i==k)y=x,k<<=1;
        }
    }
    void findfac(ll n,int c){
        if(n==1)return ;
        if(miller_rabin(n)){
            ve.push_back(n);
            return ;
        }
        ll m=n;
        while(m==n)m=pollard_rho(n,c--);
        findfac(m,c);
        findfac(n/m,c);
    }
    vector<pli> solve(ll n){
        vector<pli>res;
        ve.clear();
        findfac(n,C);
        sort(ve.begin(),ve.end());
        for(auto x:ve){
            if(res.empty()||res.back().first!=x)res.push_back({x,1});
            else res.back().second++;
        }
        return res;
    }
}
vector<pli>ans[110000];
int tag[110000];
map<int,int>mp;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,k,tmp;
    cin>>n>>k;
    int f;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        ans[i]=pollard_rho::solve(a[i]);
        a[i]=-1;
        tmp=1;
        f=0;
        for(int j=0;j<ans[i].size();j++)
        {
            ans[i][j].second=ans[i][j].second%k;
            for(int l=0;l<ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
                if(tmp>100000)
                {
                    f=1;
                    break;
                }
            }
            if(f)break;
        }
        if(!f)
        {
            mp[tmp]++;
            a[i]=tmp;
        }
    }
    ll fin=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]==-1||tag[a[i]]==1)continue;
        tag[a[i]]=1;
        tmp=1;
        f=0;
        for(int j=0;j<ans[i].size();j++)
        {
            if(!ans[i][j].second)continue;
            for(int l=0;l<k-ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
                if(tmp>100000)
                {
                    f=1;
                    break;
                }
            }
        }
        if(f)continue;
        tag[tmp]=1;
        if(a[i]==tmp)fin+=mp[a[i]]*(mp[a[i]]-1)/2;
        else fin+=mp[a[i]]*mp[tmp];
    }
    cout<<fin<<"\n";
    return 0;
}


/****************************
* Author : 水娃             *
* Date : 2019-10-27-15.19   *
****************************/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
#define mst(a,b) memset(a,b,sizeof(a))
#define ll long long
#define debug(a) cout<<#a<<" is "<<a<<"\n"
const int MAXN=(int)2e5+10;
const int mo=(int)1e9+7;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
int a[110000];
typedef pair<ll,int> pli;
namespace pollard_rho{
    const int C=2307;
    const int S=10;
    mt19937_64 rd(time(0));
    vector<ll>ve;
    ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
    ll mul(ll a,ll b,ll mod){return (a*b-(ll)(a/(long double)mod*b+1e-3)*mod+mod)%mod;}
    ll power(ll a,ll b,ll mod){
        ll res=1;a%=mod;
        while(b){
            if(b&1)res=mul(res,a,mod);
            a=mul(a,a,mod);
            b>>=1;
        }
        return res;
    }
    bool check(ll a,ll n){
        ll m=n-1,x,y;
        int j=0;
        while(!(m&1))m>>=1,j++;
        x=power(a,m,n);
        for(int i=1;i<=j;x=y,i++){
            y=mul(x,x,n);
            if(y==1&&x!=1&&x!=n-1)return 1;
        }
        return y!=1;
    }
    bool miller_rabin(ll n){
        ll a;
        if(n==1)return 0;
        if(n==2)return 1;
        if(!(n&1))return 0;
        for(int i=0;i<S;i++)if(check(rd()%(n-1)+1,n))return 0;
        return 1;
    }
    ll pollard_rho(ll n,int c){
        ll i=1,k=2,x=rd()%n,y=x,d;
        while(1){
            i++;x=(mul(x,x,n)+c)%n,d=gcd(y-x,n);
            if(d>1&&d<n)return d;
            if(y==x)return n;
            if(i==k)y=x,k<<=1;
        }
    }
    void findfac(ll n,int c){
        if(n==1)return ;
        if(miller_rabin(n)){
            ve.push_back(n);
            return ;
        }
        ll m=n;
        while(m==n)m=pollard_rho(n,c--);
        findfac(m,c);
        findfac(n/m,c);
    }
    vector<pli> solve(ll n){
        vector<pli>res;
        ve.clear();
        findfac(n,C);
        sort(ve.begin(),ve.end());
        for(auto x:ve){
            if(res.empty()||res.back().first!=x)res.push_back({x,1});
            else res.back().second++;
        }
        return res;
    }
}
vector<pli>ans[110000];
int tag[110000];
map<int,int>mp;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,k,tmp;
    cin>>n>>k;
    int f;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        ans[i]=pollard_rho::solve(a[i]);
        a[i]=-1;
        tmp=1;
        f=0;
        for(int j=0;j<ans[i].size();j++)
        {
            ans[i][j].second=ans[i][j].second%k;
            for(int l=0;l<ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
                if(tmp>100000)
                {
                    f=1;
                    break;
                }
            }
            if(f)break;
        }
        if(!f)
        {
            mp[tmp]++;
            a[i]=tmp;
        }
    }
    ll fin=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]==-1||tag[a[i]]==1)continue;
        tag[a[i]]=1;
        tmp=1;
        for(int j=0;j<ans[i].size();j++)
        {
            if(!ans[i][j].second)continue;
            for(int l=0;l<k-ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
            }
        }
        if(tmp>100000||tmp<0||a[i]<0||a[i]>100000)continue;
        tag[tmp]=1;
        if(a[i]==tmp)fin+=mp[a[i]]*(mp[a[i]]-1)/2;
        else fin+=mp[a[i]]*mp[tmp];
    }
    cout<<fin<<"\n";
    return 0;
}


/****************************
* Author : 水娃             *
* Date : 2019-10-27-15.19   *
****************************/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
#define mst(a,b) memset(a,b,sizeof(a))
#define ll long long
#define debug(a) cout<<#a<<" is "<<a<<"\n"
const int MAXN=(int)2e5+10;
const int mo=(int)1e9+7;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
int a[110000];
typedef pair<ll,int> pli;
namespace pollard_rho{
    const int C=2307;
    const int S=10;
    mt19937_64 rd(time(0));
    vector<ll>ve;
    ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
    ll mul(ll a,ll b,ll mod){return (a*b-(ll)(a/(long double)mod*b+1e-3)*mod+mod)%mod;}
    ll power(ll a,ll b,ll mod){
        ll res=1;a%=mod;
        while(b){
            if(b&1)res=mul(res,a,mod);
            a=mul(a,a,mod);
            b>>=1;
        }
        return res;
    }
    bool check(ll a,ll n){
        ll m=n-1,x,y;
        int j=0;
        while(!(m&1))m>>=1,j++;
        x=power(a,m,n);
        for(int i=1;i<=j;x=y,i++){
            y=mul(x,x,n);
            if(y==1&&x!=1&&x!=n-1)return 1;
        }
        return y!=1;
    }
    bool miller_rabin(ll n){
        ll a;
        if(n==1)return 0;
        if(n==2)return 1;
        if(!(n&1))return 0;
        for(int i=0;i<S;i++)if(check(rd()%(n-1)+1,n))return 0;
        return 1;
    }
    ll pollard_rho(ll n,int c){
        ll i=1,k=2,x=rd()%n,y=x,d;
        while(1){
            i++;x=(mul(x,x,n)+c)%n,d=gcd(y-x,n);
            if(d>1&&d<n)return d;
            if(y==x)return n;
            if(i==k)y=x,k<<=1;
        }
    }
    void findfac(ll n,int c){
        if(n==1)return ;
        if(miller_rabin(n)){
            ve.push_back(n);
            return ;
        }
        ll m=n;
        while(m==n)m=pollard_rho(n,c--);
        findfac(m,c);
        findfac(n/m,c);
    }
    vector<pli> solve(ll n){
        vector<pli>res;
        ve.clear();
        findfac(n,C);
        sort(ve.begin(),ve.end());
        for(auto x:ve){
            if(res.empty()||res.back().first!=x)res.push_back({x,1});
            else res.back().second++;
        }
        return res;
    }
}
vector<pli>ans[110000];
int tag[110000];
map<ll,ll>mp;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    ll n,k,tmp;
    cin>>n>>k;
    int f;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        ans[i]=pollard_rho::solve(a[i]);
        a[i]=-1;
        tmp=1;
        f=0;
        for(int j=0;j<ans[i].size();j++)
        {
            ans[i][j].second=ans[i][j].second%k;
            for(int l=0;l<ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
                if(tmp>100000)
                {
                    f=1;
                    break;
                }
            }
            if(f)break;
        }
        if(!f)
        {
            mp[tmp]++;
            a[i]=tmp;
        }
    }
    ll fin=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]==-1||tag[a[i]]==1)continue;
        tag[a[i]]=1;
        tmp=1;
        f=0;
        for(int j=0;j<ans[i].size();j++)
        {
            if(!ans[i][j].second)continue;
            for(int l=0;l<k-ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
                if(tmp>100000)
                {
                    f=1;
                    break;
                }
            }
        }
        if(f)continue;
        tag[tmp]=1;
        if(a[i]==tmp)fin+=mp[a[i]]*(mp[a[i]]-1)/2;
        else fin+=mp[a[i]]*mp[tmp];
    }
    cout<<fin<<"\n";
    return 0;
}


/****************************
* Author : 水娃             *
* Date : 2019-10-27-15.19   *
****************************/
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
#define mst(a,b) memset(a,b,sizeof(a))
#define ll long long
#define debug(a) cout<<#a<<" is "<<a<<"\n"
const int MAXN=(int)2e5+10;
const int mo=(int)1e9+7;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
int a[110000];
typedef pair<ll,int> pli;
namespace pollard_rho{
    const int C=2307;
    const int S=10;
    mt19937_64 rd(time(0));
    vector<ll>ve;
    ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
    ll mul(ll a,ll b,ll mod){return (a*b-(ll)(a/(long double)mod*b+1e-3)*mod+mod)%mod;}
    ll power(ll a,ll b,ll mod){
        ll res=1;a%=mod;
        while(b){
            if(b&1)res=mul(res,a,mod);
            a=mul(a,a,mod);
            b>>=1;
        }
        return res;
    }
    bool check(ll a,ll n){
        ll m=n-1,x,y;
        int j=0;
        while(!(m&1))m>>=1,j++;
        x=power(a,m,n);
        for(int i=1;i<=j;x=y,i++){
            y=mul(x,x,n);
            if(y==1&&x!=1&&x!=n-1)return 1;
        }
        return y!=1;
    }
    bool miller_rabin(ll n){
        ll a;
        if(n==1)return 0;
        if(n==2)return 1;
        if(!(n&1))return 0;
        for(int i=0;i<S;i++)if(check(rd()%(n-1)+1,n))return 0;
        return 1;
    }
    ll pollard_rho(ll n,int c){
        ll i=1,k=2,x=rd()%n,y=x,d;
        while(1){
            i++;x=(mul(x,x,n)+c)%n,d=gcd(y-x,n);
            if(d>1&&d<n)return d;
            if(y==x)return n;
            if(i==k)y=x,k<<=1;
        }
    }
    void findfac(ll n,int c){
        if(n==1)return ;
        if(miller_rabin(n)){
            ve.push_back(n);
            return ;
        }
        ll m=n;
        while(m==n)m=pollard_rho(n,c--);
        findfac(m,c);
        findfac(n/m,c);
    }
    vector<pli> solve(ll n){
        vector<pli>res;
        ve.clear();
        findfac(n,C);
        sort(ve.begin(),ve.end());
        for(auto x:ve){
            if(res.empty()||res.back().first!=x)res.push_back({x,1});
            else res.back().second++;
        }
        return res;
    }
}
vector<pli>ans[110000];
int tag[110000];
map<int,int>mp;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,k,tmp;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        ans[i]=pollard_rho::solve(a[i]);
        tmp=1;
        for(int j=0;j<ans[i].size();j++)
        {
            ans[i][j].second=ans[i][j].second%k;
            for(int l=0;l<ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
            }
        }
        mp[tmp]++;
        a[i]=tmp;
    }
    ll fin=0;
    for(int i=1;i<=n;i++)
    {
        if(tag[a[i]])continue;
        tag[a[i]]=1;
        tmp=1;
        for(int j=0;j<ans[i].size();j++)
        {
            if(!ans[i][j].second)continue;
            for(int l=0;l<k-ans[i][j].second;l++)
            {
                tmp=tmp*ans[i][j].first;
            }
        }
        if(tmp>100000||tmp<0||a[i]<0||a[i]>100000)continue;
        tag[tmp]=1;
        if(a[i]==tmp)fin+=mp[a[i]]*(mp[a[i]]-1)/2;
        else fin+=mp[a[i]]*mp[tmp];
    }
    cout<<fin<<"\n";
    return 0;
}


#include<cmath>
#include<unordered_map>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn];
unordered_map<long long, int> mp;

long long mul(long long x, long long p) {
    long long ans = 1;
    while(p) {
        if(p & 1) ans *= x;
        x *= x;
        p >>= 1;
    }
    return ans;
}

long long useful() {
    long long ans = 0, ex, pi, tmp, en;
    for(int i = 0; i < n; i++) {
        if(!i || a[i] != a[i-1]) {
            ex = 1, tmp = a[i], pi = 1, en = sqrt(tmp) + 1;
            for(long long i = 2; tmp != 1 && i < en; i++) {
                int num = 0;
                while(tmp % i == 0) {
                    num++;
                    tmp /= i;
                }
                num %= k;
                if(num) {
                    pi *= mul(i, num);
                    ex *= mul(i, k-num);
                }
            }
        }
        if(tmp != 1) {
            pi *= tmp;
            ex *= mul(tmp, k-1);
            tmp = 1;
        }
        if(mp.count(ex)) ans += mp[ex];
        if(mp.count(pi)) mp[pi]++;
        else mp[pi] = 1;
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    cout << useful() << endl;
    return 0;
}


#include<unordered_map>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn];
unordered_map<long long, int> mp;

long long mul(long long x, long long p) {
    long long ans = 1;
    while(p) {
        if(p & 1) ans *= x;
        x *= x;
        p >>= 1;
    }
    return ans;
}

long long useful() {
    long long ans = 0, ex, pi, tmp;
    for(int i = 0; i < n; i++) {
        if(!i || a[i] != a[i-1]) {
            ex = 1, tmp = a[i], pi = 1;
            for(long long i = 2; tmp != 1; i++) {
                int num = 0;
                while(tmp % i == 0) {
                    num++;
                    tmp /= i;
                }
                num %= k;
                if(num) {
                    pi *= mul(i, num);
                    ex *= mul(i, k-num);
                }
            }
        }
        if(mp.count(ex)) ans += mp[ex];
        if(mp.count(pi)) mp[pi]++;
        else mp[pi] = 1;
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    cout << useful() << endl;
    return 0;
}


#include<unordered_map>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn];
unordered_map<long long, int> mp;

long long mul(long long x, long long p) {
    long long ans = 1;
    while(p) {
        if(p & 1) ans *= x;
        x *= x;
        p >>= 1;
    }
    return ans;
}

long long useful() {
    long long ans = 0;
    for(int i = 0; i < n; i++) {
        long long ex = 1, tmp = a[i], pi = 1;
        for(long long i = 2; tmp != 1; i++) {
            int num = 0;
            while(tmp % i == 0) {
                num++;
                tmp /= i;
            }
            num %= k;
            if(num) {
                pi *= mul(i, num);
                ex *= mul(i, k-num);
            }
        }
        if(mp.count(ex)) ans += mp[ex];
        if(mp.count(pi)) mp[pi]++;
        else mp[pi] = 1;
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    // sort(a, a+n);
    cout << useful() << endl;
    return 0;
}


#include<map>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn];
vector<long long> vec;
map<long long, long long> mp;

long long getmul(long long i) {
    long long ans = i;
    for(int p = 1; p < k; p++) ans *= i;
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    mp[a[0]] = 1;
    for(int i = 1; i < n; i++) {
        if(a[i] == a[i-1]) mp[a[i]]++;
        else mp[a[i]] = 1;
    }
    long long max_m = a[n-1] * a[n-2];
    for(long long i = 1; ; i++) {
        long long mul = getmul(i);
        if(mul > max_m) break;
        vec.push_back(mul);
    }
    int si = vec.size()-1;
    long long ans = 0, laans = 0;
    for(int i = 0; i < n; i++) {
        if(!i || a[i] != a[i-1]) {
            laans = 0;
            for(int j = si; j >= 0; j--) {
                if(vec[j] < a[i]) break;
                if(vec[j] % a[i]) continue;
                long long tk = vec[j] / a[i];
                if(!mp.count(tk)) continue;
                long long p = mp[tk] - (tk == a[i]);
                laans += p;
            }
        }
        ans += laans;
    }
    cout << ans / 2 << endl;
    return 0;
}


#include<map>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn], max_m;
map<long long, long long> mp;

long long mul(long long x, long long p) {
    long long ans = 1;
    while(p) {
        if(p & 1) ans *= x;
        x *= x;
        p >>= 1;
    }
    return ans;
}

long long useful(long long tn) {
    if(tn == 1) return mp[1] - 1;
    long long ans = 0, ex = 1, tmp = tn;
    for(long long i = 2; tmp != 1; i++) {
        int num = 0;
        while(tmp % i == 0) {
            num++;
            tmp /= i;
        }
        if(num % k) ex *= mul(i, k-(num%k));
    }
    long long key = tn * ex;
    // cout << tn << " " << ex << " " << key << endl;
    for(long long i = ex; ; i += key) {
        long long ri = i / tn;
        if(ri > max_m) break;
        if(!mp.count(ri)) continue;
        ans += mp[ri] - (ri == tn);
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    max_m = a[n-2] * a[n-1];
    mp[a[0]] = 1;
    for(int i = 1; i < n; i++) {
        if(a[i] == a[i-1]) mp[a[i]]++;
        else mp[a[i]] = 1;
    }
    long long ans = 0, laans = 0;
    for(int i = 0; i < n; i++) {
        if(!i || a[i] != a[i-1]) {
            laans = useful(a[i]);
        }
        ans += laans;
    }
    cout << ans / 2 << endl;
    return 0;
}


#include<map>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn], max_m;
map<long long, long long> mp;

long long mul(long long x, long long p) {
    long long ans = 1;
    while(p) {
        if(p & 1) ans *= x;
        x *= x;
        p >>= 1;
    }
    return ans;
}

long long useful(long long tn) {
    if(tn == 1) return mp[1] - 1;
    long long ans = 0, ex = 1, tmp = tn;
    for(long long i = 2; tmp != 1; i++) {
        int num = 0;
        while(tmp % i == 0) {
            num++;
            tmp /= i;
        }
        if(num % k) ex *= mul(i, k-(num%k));
    }
    long long key = tn * ex;
    for(long long i = key; i <= max_m; i += key) {
        long long ri = i / tn;
        if(!mp.count(ri)) continue;
        ans += mp[ri] - (ri == tn);
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    max_m = a[n-2] * a[n-1];
    mp[a[0]] = 1;
    for(int i = 1; i < n; i++) {
        if(a[i] == a[i-1]) mp[a[i]]++;
        else mp[a[i]] = 1;
    }
    long long ans = 0, laans = 0;
    for(int i = 0; i < n; i++) {
        if(!i || a[i] != a[i-1]) {
            laans = useful(a[i]);
        }
        ans += laans;
    }
    cout << ans / 2 << endl;
    return 0;
}


#include<map>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn], max_m;
map<long long, long long> mp;

long long mul(long long x, long long p) {
    long long ans = 1;
    while(p) {
        if(p & 1) ans *= x;
        x *= x;
        p >>= 1;
    }
    return ans;
}

long long useful(long long tn) {
    if(tn == 1) return mp[1] - 1;
    long long ans = 0, ex = 1, tmp = tn;
    for(long long i = 2; tmp != 1; i++) {
        int num = 0;
        while(tmp % i == 0) {
            num++;
            tmp /= i;
        }
        if(num % k) ex *= mul(i, k-(num%k));
    }
    long long key = tn * ex;
    for(long long i = key; ; i += key) {
        long long ri = i / tn;
        if(ri > max_m) break;
        if(!mp.count(ri)) continue;
        ans += mp[ri] - (ri == tn);
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    max_m = a[n-2] * a[n-1];
    mp[a[0]] = 1;
    for(int i = 1; i < n; i++) {
        if(a[i] == a[i-1]) mp[a[i]]++;
        else mp[a[i]] = 1;
    }
    long long ans = 0, laans = 0;
    for(int i = 0; i < n; i++) {
        if(!i || a[i] != a[i-1]) {
            laans = useful(a[i]);
        }
        ans += laans;
    }
    cout << ans / 2 << endl;
    return 0;
}


#include<unordered_map>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn], max_m;
unordered_map<long long, long long> mp;
vector<long long> pri;

long long mul(long long x, long long p) {
    long long ans = 1;
    while(p) {
        if(p & 1) ans *= x;
        x *= x;
        p >>= 1;
    }
    return ans;
}

void getpri() {
    for(int i = 1; ; i++) {
        pri.push_back(mul(i, k));
        if(pri.back() > max_m) return;
    }
}

long long useful(long long tn) {
    // if(tn == 1) return mp[1] - 1;
    long long ans = 0, ex = 1, tmp = tn;
    for(long long i = 2; tmp != 1; i++) {
        int num = 0;
        while(tmp % i == 0) {
            num++;
            tmp /= i;
        }
        if(num % k) ex *= mul(i, k-(num%k));
    }
    for(long long i = 0; ; i++) {
        long long ts = pri[i] * ex;
        if(ts > max_m) break;
        if(!mp.count(ts)) continue;
        ans += mp[ts] - (ts == tn);
    }
    // cout << tn << " " << ans << endl;
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    max_m = a[n-2] * a[n-1];
    getpri();
    mp[a[0]] = 1;
    for(int i = 1; i < n; i++) {
        if(a[i] == a[i-1]) mp[a[i]]++;
        else mp[a[i]] = 1;
    }
    long long ans = 0, laans = 0;
    for(int i = 0; i < n; i++) ans += useful(a[i]);
    cout << ans / 2 << endl;
    return 0;
}


#include<map>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn], max_m;
map<long long, long long> mp;
vector<long long> pri;

long long mul(long long x, long long p) {
    long long ans = 1;
    while(p) {
        if(p & 1) ans *= x;
        x *= x;
        p >>= 1;
    }
    return ans;
}

void getpri() {
    for(int i = 1; ; i++) {
        pri.push_back(mul(i, k));
        if(pri.back() > max_m) return;
    }
}

long long useful(long long tn) {
    // if(tn == 1) return mp[1] - 1;
    long long ans = 0, ex = 1, tmp = tn;
    for(long long i = 2; tmp != 1; i++) {
        int num = 0;
        while(tmp % i == 0) {
            num++;
            tmp /= i;
        }
        if(num % k) ex *= mul(i, k-(num%k));
    }
    for(long long i = 0; ; i++) {
        long long ts = pri[i] * ex;
        if(ts > max_m) break;
        if(!mp.count(ts)) continue;
        ans += mp[ts] - (ts == tn);
    }
    // cout << tn << " " << ans << endl;
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    max_m = a[n-2] * a[n-1];
    getpri();
    mp[a[0]] = 1;
    for(int i = 1; i < n; i++) {
        if(a[i] == a[i-1]) mp[a[i]]++;
        else mp[a[i]] = 1;
    }
    long long ans = 0, laans = 0;
    for(int i = 0; i < n; i++) ans += useful(a[i]);
    cout << ans / 2 << endl;
    return 0;
}


#include<cmath>
#include<unordered_map>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn = 1e5 + 5;
long long n, k, a[maxn];
unordered_map<long long, int> mp;

long long mul(long long x, long long p) {
    long long ans = 1;
    while(p) {
        if(p & 1) ans *= x;
        x *= x;
        p >>= 1;
    }
    return ans;
}

long long useful() {
    long long ans = 0, ex, pi, tmp, en;
    for(int i = 0; i < n; i++) {
        if(!i || a[i] != a[i-1]) {
            ex = 1, tmp = a[i], pi = 1, en = sqrt(tmp) + 1;
            for(long long i = 2; tmp != 1 && i < en; i++) {
                int num = 0;
                while(tmp % i == 0) {
                    num++;
                    tmp /= i;
                }
                num %= k;
                if(num) {
                    pi *= mul(i, num);
                    ex *= mul(i, k-num);
                }
            }
        }
        if(mp.count(ex)) ans += mp[ex];
        if(mp.count(pi)) mp[pi]++;
        else mp[pi] = 1;
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    cout << useful() << endl;
    return 0;
}