#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const long long mod = 998244353;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, k;
map<unsigned long long, int> mp;
int prime[100005], cnt, f[100005];
unsigned long long bin[100005 / 3][104];
bool vis[100005];
long long ans;
unsigned long long get_now(int x) {
  unsigned long long ans = 1;
  while (x != 1) {
    int now = 0, p = f[x];
    while (x % prime[p] == 0) now++, x /= prime[p];
    now = now % k;
    ans = ans * bin[p][now];
  }
  return ans;
}
unsigned long long get_nxt(int x) {
  unsigned long long ans = 1;
  while (x != 1) {
    int now = 0, p = f[x];
    while (x % prime[p] == 0) now++, x /= prime[p];
    now = (now - 1) % k + 1;
    now = k - now;
    ans = ans * bin[p][now];
  }
  return ans;
}
int main() {
  int i, j, x;
  for (i = 2; i <= 100000; i++) {
    if (!vis[i]) {
      prime[++cnt] = i, f[i] = cnt;
      bin[cnt][0] = 1;
      for (j = 1; j <= 100; j++) bin[cnt][j] = bin[cnt][j - 1] * prime[cnt];
    }
    for (j = 1; j <= cnt && prime[j] * i <= 100000; j++) {
      vis[prime[j] * i] = 1;
      f[prime[j] * i] = f[i];
      if (i % prime[j] == 0) break;
    }
  }
  n = read(), k = read();
  for (i = 1; i <= n; i++) {
    x = read();
    unsigned long long now = get_now(x), nxt = get_nxt(x);
    ans += mp[nxt];
    mp[now]++;
  }
  printf("%lld\n", ans);
  return 0;
}
