#include <bits/stdc++.h>
using namespace std;
map<long long, int> cnt;
int lp[100005];
long long p[100005][102];
void sieve() {
  for (int i = 2; i <= 100000; i++) {
    if (!lp[i]) {
      lp[i] = i;
      for (int j = i + i; j <= 100000; j += i)
        if (!lp[j]) lp[j] = i;
    }
  }
}
int main() {
  int n, k, a;
  long long ans = 0;
  sieve();
  for (int i = 1; i <= 100000; i++) {
    p[i][0] = 1;
    for (int j = 1; j <= 100; j++) {
      p[i][j] = p[i][j - 1] * i;
      if (p[i][j] > 1e9) p[i][j] = 0;
    }
  }
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    long long cur = 1;
    long long mate = 1;
    while (a > 1) {
      int cnt = 0;
      int prime = lp[a];
      while (a % prime == 0) {
        a /= prime;
        cnt++;
      }
      cnt %= k;
      cur *= p[prime][cnt];
      mate *= p[prime][(k - cnt) % k];
      if (mate > 1e9) mate = 0;
    }
    if (mate != 0 && cnt.count(mate)) ans += cnt[mate];
    cnt[cur]++;
  }
  printf("%lld\n", ans);
  return 0;
}
