#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool umax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
long long POW(long long a, long long p, long long M) {
  if (!p) return 1LL;
  long long T = POW(a, p / 2, M);
  T = T * T % M;
  if (p & 1) T = T * (a % M) % M;
  return T;
}
long long SQRT(long long a) {
  long long b = (long long)sqrtl(((double)a) + 0.5);
  while (b * b < a) ++b;
  while (b * b > a) --b;
  return (b * b == a) ? b : -1;
}
const long long MOD = 1e9 + 7;
const long long N = 1e6;
long long lp[N + 1];
vector<long long> pr;
void LPS() {
  for (long long i = 2; i <= N; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (long long j = 0;
         j < (long long)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N; ++j)
      lp[i * pr[j]] = pr[j];
  }
}
signed main() {
  cout.precision(10);
  cout << fixed;
  LPS();
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long f = 0;
  const long long NN = 1e5 + 2;
  long long dp[NN];
  memset(dp, 0, sizeof(dp));
  for (long long i = 0; i < a.size(); i++) {
    long long c = a[i];
    long long pr = 1;
    long long ex = 1;
    vector<long long> ss;
    while (a[i] != 1) {
      long long x = lp[a[i]];
      long long ct = 0;
      while (a[i] % x == 0) {
        a[i] /= x;
        ct++;
      }
      long long tk = ct % k;
      if (tk)
        for (long long j = tk + 1; j <= k; j++) {
          pr *= x;
          if (pr >= NN) break;
        }
      for (long long j = 1; j <= tk; j++) {
        ex *= x;
        if (ex >= NN) break;
      }
    }
    if (pr < NN) f += dp[pr];
    if (ex < NN) dp[ex]++;
  }
  cout << f << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}
