#include <bits/stdc++.h>
using namespace std;
vector<long long> is_prime((long long)1e5 + 1, 1);
vector<long long> primes;
void gen_primes() {
  is_prime[0] = is_prime[1] = 0;
  for (long long i = 2; i * i <= (long long)1e5; i++) {
    if (is_prime[i]) {
      primes.push_back(i);
      for (long long j = 2 * i; j <= (long long)1e5; j += i) {
        is_prime[j] = 0;
      }
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  gen_primes();
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n), b(n, 1);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    long long x = a[i];
    for (long long j = 0; j < (long long)primes.size(); j++) {
      long long cnt = 0;
      while (a[i] % primes[j] == 0) {
        a[i] /= primes[j];
        x /= primes[j];
        cnt++;
      }
      for (long long t = 0; t < (cnt % k); t++) {
        a[i] *= primes[j];
      }
      for (long long t = 0; t < (k - (cnt % k)) % k; t++) {
        b[i] *= primes[j];
      }
    }
    if (x > 1) {
      for (long long t = 0; t < k - 1; t++) {
        b[i] *= x;
      }
    }
  }
  map<long long, long long> mp;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += (long long)mp[b[i]];
    mp[a[i]]++;
  }
  cout << ans << '\n';
  return 0;
}
