#include <bits/stdc++.h>
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long MAX = 510000;
const long long INF = 1LL << 60;
const long long MOD = 1000000007LL;
using namespace std;
long long n, k;
map<long long, long long> prime_factor(long long a) {
  map<long long, long long> ret;
  for (long long i = 2; i * i <= a; i++) {
    while (a % i == 0 && a != 0) {
      ret[i]++;
      a /= i;
    }
  }
  if (a != 1) {
    ret[a]++;
  }
  for (auto itr = ret.begin(); itr != ret.end();) {
    itr->second %= k;
    if (itr->second == 0) {
      itr = ret.erase(itr);
    } else {
      itr++;
    }
  }
  return ret;
}
int main() {
  scanf("%lld %lld", &n, &k);
  vector<long long> a(n);
  map<map<long long, long long>, long long> mp;
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    mp[prime_factor(a[i])]++;
  }
  long long res = 0;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    map<long long, long long> req;
    map<long long, long long> b = itr->first;
    for (auto it = b.begin(); it != b.end(); it++) {
      req[it->first] = k - it->second;
    }
    if (req == b) {
      res += itr->second * (itr->second - 1);
    } else {
      if (mp.find(req) != mp.end()) res += mp[req] * itr->second;
    }
  }
  printf("%lld\n", res / 2);
  return 0;
}
