#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  int a[n];
  map<vector<pair<int, int> >, int> cnt;
  vector<pair<int, int> > primes, comp;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    int tmp = a[i];
    primes.clear();
    int pcnt = 0;
    if (!(tmp & 1)) {
      while (!(tmp & 1)) tmp = (tmp >> 1), pcnt++;
      if (pcnt % k > 0) primes.push_back({2, pcnt % k});
    }
    for (long long i = 3; i * i <= tmp; i = i + 2) {
      if (tmp % i == 0) {
        pcnt = 0;
        while (tmp % i == 0) tmp = tmp / i, pcnt++;
        if (pcnt % k > 0) primes.push_back({i, pcnt % k});
      }
    }
    if (tmp > 2) {
      if (primes.size() == 0 || primes.back().first != tmp) {
        primes.push_back({tmp, 1});
      } else {
        primes.back().second++;
        if (primes.back().second % k == 0) primes.pop_back();
      }
    }
    comp.clear();
    for (auto x : primes) {
      comp.push_back({x.first, k - x.second});
    }
    if (cnt.count(comp)) {
      ans += cnt[comp];
    }
    cnt[primes]++;
  }
  cout << ans << endl;
  return 0;
}
