#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
map<map<int, int>, int> cnt;
int isprime[maxn], lstv[maxn];
long long ans = 0;
int n, k;
inline void ins(int x) {
  map<int, int> M;
  if (x != 1)
    while (!isprime[x]) M[lstv[x]]++, x /= lstv[x];
  if (x != 1) M[x]++;
  map<int, int> T;
  for (map<int, int>::iterator it = M.begin(); it != M.end(); it++)
    it->second %= k;
  for (map<int, int>::iterator it = M.begin(); it != M.end(); it++)
    if (it->second != 0) T[it->first] = it->second;
  ans += cnt[T];
  for (map<int, int>::iterator it = T.begin(); it != T.end(); it++)
    it->second = k - it->second;
  cnt[T]++;
}
int main() {
  memset(isprime, 1, sizeof(isprime));
  isprime[1] = 0;
  for (int i = 2; i <= 100000; i++)
    if (isprime[i])
      for (int j = i + i; j <= 100000; j += i) isprime[j] = 0, lstv[j] = i;
  scanf("%d%d", &n, &k);
  for (int i = 1, a; i <= n; i++) scanf("%d", &a), ins(a);
  printf("%lld\n", ans);
  return 0;
}
