#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long INF = 1LL << 60;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
struct Eratos {
  vector<long long> primes;
  vector<bool> isprime;
  vector<long long> mebius;
  vector<long long> min_factor;
  Eratos(long long MAX)
      : primes(),
        isprime(MAX + 1, true),
        mebius(MAX + 1, 1),
        min_factor(MAX + 1, -1) {
    isprime[0] = isprime[1] = false;
    min_factor[0] = 0, min_factor[1] = 1;
    for (long long i = 2; i <= MAX; ++i) {
      if (!isprime[i]) continue;
      primes.push_back(i);
      mebius[i] = -1;
      min_factor[i] = i;
      for (long long j = i * 2; j <= MAX; j += i) {
        isprime[j] = false;
        if ((j / i) % i == 0)
          mebius[j] = 0;
        else
          mebius[j] = -mebius[j];
        if (min_factor[j] == -1) min_factor[j] = i;
      }
    }
  }
  vector<pair<long long, long long>> prime_factors(long long n) {
    vector<pair<long long, long long>> res;
    while (n != 1) {
      long long prime = min_factor[n];
      long long exp = 0;
      while (min_factor[n] == prime) {
        ++exp;
        n /= prime;
      }
      res.push_back(make_pair(prime, exp));
    }
    return res;
  }
  vector<long long> divisors(long long n) {
    vector<long long> res({1});
    auto pf = prime_factors(n);
    for (auto p : pf) {
      long long n = (long long)res.size();
      for (long long i = 0; i < n; ++i) {
        long long v = 1;
        for (long long j = 0; j < p.second; ++j) {
          v *= p.first;
          res.push_back(res[i] * v);
        }
      }
    }
    return res;
  }
};
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  const long long MAX = 100000;
  Eratos er(MAX);
  map<long long, long long> cnt;
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    auto pf = er.prime_factors(a[i]);
    for (auto& p : pf) {
      p.second %= k;
    }
    long long now = 1;
    long long nxt = 1;
    for (auto p : pf) {
      for (long long j = 0; j < p.second; ++j) now *= p.first;
      long long co = (p.second == 0 ? 0 : k - p.second);
      for (long long j = 0; j < co; ++j) {
        nxt *= p.first;
        if (nxt >= 1e10) {
          nxt = -1;
          break;
        }
      }
      if (nxt == -1) break;
    }
    ans += (long long)cnt[nxt];
    cnt[now]++;
  }
  cout << ans << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
