#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int MOD = 1e9 + 7;
long long qpow(long long x, long long n, long long mod = MOD) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
namespace Solver {
void InitOnce() {}
int n, k;
void Read() {
  int res = scanf("%d%d", &n, &k);
  if (res == -1) exit(0);
}
int a[100005];
int X[100005];
int cnt[100005];
bool np[100005];
int p[100005];
void Solve() {
  np[1] = 1;
  int ptop = 0;
  for (int i = 2; i <= 100000; ++i) {
    if (np[i]) continue;
    p[++ptop] = i;
    for (int j = i + i; j <= 100000; j += i) np[j] = 1;
  }
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    long long y = 1;
    int x = a[i];
    for (int j = 1; p[j] * p[j] <= x; ++j) {
      if (x % p[j] == 0) {
        int kk = 0;
        while (x % p[j] == 0) {
          x /= p[j];
          ++kk;
        }
        kk = kk % k;
        while (kk--) y *= p[j];
      }
    }
    y *= x;
    X[i] = y;
    ++cnt[y];
  }
  long long sum = 0;
  for (int i = 1; i <= n; ++i) {
    int x = a[i];
    long long y = 1;
    bool suc = 1;
    for (int j = 1; suc && p[j] * p[j] <= x; ++j) {
      if (x % p[j] == 0) {
        int kk = 0;
        while (x % p[j] == 0) {
          x /= p[j];
          ++kk;
        }
        kk = (k - kk % k) % k;
        while (suc && kk--) {
          if (y * p[j] > 100000) {
            suc = 0;
            break;
          }
          y *= p[j];
        }
      }
    }
    if (x != 1) {
      int kk = k - 1;
      while (suc && kk--) {
        if (y * x > 100000) {
          suc = 0;
          break;
        }
        y *= x;
      }
    }
    if (suc) {
      sum += cnt[y];
      if (X[i] == y) --sum;
    }
  }
  assert(sum % 2 == 0);
  printf("%lld\n", sum / 2);
}
}  // namespace Solver
int main() {
  Solver::InitOnce();
  while (true) {
    Solver::Read();
    Solver::Solve();
  }
  return 0;
}
