#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 3;
const long long MAXN = 1e5 + 10;
long long spf[MAXN + 3], store[N], _store[N], n, k;
map<long long, long long> K, _K;
long long power(long long base, long long exp) {
  long long res = 1;
  while (exp) {
    if (exp & 1) {
      res *= base;
    }
    exp >>= 1;
    base *= base;
  }
  return res;
}
void sieve() {
  spf[1] = 1;
  for (long long i = 2; i <= MAXN; i++) spf[i] = i;
  for (long long i = 4; i <= MAXN; i += 2) spf[i] = 2;
  for (long long i = 3; i * i <= MAXN; i++) {
    if (spf[i] == i) {
      for (long long j = i * i; j <= MAXN; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
void work(long long x, long long idx) {
  map<long long, long long> pfactors, _pfactors;
  while (x != 1) {
    pfactors[spf[x]]++;
    pfactors[spf[x]] %= k;
    x = x / spf[x];
  }
  long long res = 1, _res = 1;
  for (auto it : pfactors) {
    res *= power(it.first, it.second);
    _res *= power(it.first, (k - it.second) % k);
  }
  K[res]++;
  _K[res]++;
  store[idx] = res;
  _store[idx] = _res;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  sieve();
  cin >> n >> k;
  map<long long, long long> have;
  for (long long i = 1; i <= n; ++i) {
    long long a;
    cin >> a;
    work(a, i);
  }
  long long ans = 0;
  for (long long i = 1; i <= n; ++i) {
    long long freq = _K[_store[i]] - (store[i] == _store[i]);
    ans += freq;
  }
  cout << ans / 2 << '\n';
}
