#include <bits/stdc++.h>
using namespace std;
const bool ready = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(12);
  return true;
}();
const double PI = acos(-1);
using ll = long long;
using pii = pair<ll, ll>;
using pdd = pair<double, double>;
using vd = vector<double>;
using vb = vector<bool>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
const ll primeAproxFactor = 20;
const ll MAXN = 100000;
vector<ll> pr(MAXN);
vector<bool> notpr(MAXN* primeAproxFactor, false);
bool init = []() {
  ll c = 0;
  ll i = 2;
  while (i < MAXN * primeAproxFactor && c < MAXN) {
    if (!notpr[i]) {
      pr[c] = i;
      c++;
      ll j = 1LL * i * i;
      while (j < primeAproxFactor * MAXN) {
        notpr[j] = true;
        j += i;
      }
    }
    i++;
  }
  return true;
}();
void solve() {
  ll n;
  cin >> n;
  ;
  ll k;
  cin >> k;
  ;
  vi a(n);
  for (ll i = 0; i < ll(n); i++) {
    cin >> a[i];
  };
  map<vector<pii>, ll> f;
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    map<ll, ll> ff;
    for (ll j = 0; pr[j] * pr[j] <= a[i]; j++) {
      while (a[i] % pr[j] == 0) {
        ff[pr[j]]++;
        a[i] /= pr[j];
      }
    }
    if (a[i] > 1) ff[a[i]]++;
    vector<pii> v;
    vector<pii> r;
    for (auto ent : ff) {
      if (ent.second % k != 0) {
        v.emplace_back(ent.first, ent.second % k);
        r.emplace_back(ent.first, k - (ent.second % k));
      }
    }
    ans += f[r];
    f[v]++;
  }
  cout << ans << endl;
}
signed main() { solve(); }
