#include <bits/stdc++.h>
using namespace std;
vector<long long> sieve;
void primes() {
  sieve.resize(100001, 0);
  for (long long i = 2; i < 100001; i++) {
    if (sieve[i]) continue;
    for (long long j = i; j < 100001; j += i) sieve[j] = i;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  primes();
  long long n, k;
  cin >> n >> k;
  map<vector<pair<long long, long long> >, long long> pf;
  long long a, c, t, ans = 0;
  for (long long i = 0; i < n; i++) {
    vector<pair<long long, long long> > tmp, rev;
    cin >> a;
    while (a > 1) {
      c = 0, t = sieve[a];
      while (a % t == 0) {
        a /= t;
        c++;
      }
      c %= k;
      if (c) {
        tmp.push_back({t, c});
        rev.push_back({t, k - c});
      }
    }
    ans += pf[rev];
    pf[tmp]++;
  }
  cout << ans << "\n";
}
