#include <bits/stdc++.h>
using namespace std;
void pe() { cout << endl; }
template <class T1>
void pe(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void pe(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void pe(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void pe(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void pe(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1>
void ps(T1 e) {
  cout << e << " ";
}
template <class T1, class T2>
void ps(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << " ";
}
template <class T1, class T2, class T3>
void ps(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << " ";
}
template <class T1, class T2, class T3, class T4>
void ps(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " ";
}
template <class T1, class T2, class T3, class T4, class T5>
void ps(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " ";
}
const long long N = 1e6 + 1;
const long long mod = 1e9 + 7;
long long modular(long long x) { return ((x % mod) + mod) % mod; }
long long add(long long a, long long b) {
  return (modular(a) + modular(b)) % mod;
}
long long mul(long long a, long long b) {
  return (modular(a) * modular(b)) % mod;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  map<vector<pair<long long, long long>>, long long> M;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    long long t;
    cin >> t;
    vector<pair<long long, long long>> P;
    for (long long j = 2; j * j <= t; j++) {
      long long c = 0;
      while (t % j == 0) {
        t /= j, c++;
      }
      if (c % k) P.push_back({j, c % k});
    }
    if (t > 1) P.push_back({t, 1});
    vector<pair<long long, long long>> C1;
    for (auto& p : P) {
      C1.push_back({p.first, k - p.second});
    }
    ans += M[C1];
    M[P]++;
  }
  pe(ans);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int tests = 1;
  while (tests--) solve();
}
