#include <bits/stdc++.h>
using namespace std;
const int kNmax = 1e5 + 5;
int v[kNmax];
int greatest[kNmax];
int n, k;
void build_sieve() {
  for (int i = 1; i < kNmax; i++) greatest[i] = i;
  for (int i = 2; i < kNmax; i++) {
    if (greatest[i] != i) continue;
    for (int j = i + i; j < kNmax; j += i) greatest[j] = i;
  }
}
pair<vector<pair<int, int>>, vector<pair<int, int>>> divisors_of(int x) {
  map<int, int> divs;
  while (x > 1) {
    divs[greatest[x]]++;
    x /= greatest[x];
  }
  vector<pair<int, int>> f, c;
  for (auto pii : divs) {
    int pw = pii.second % k;
    if (pw == 0) continue;
    f.emplace_back(pii.first, pw);
    c.emplace_back(pii.first, k - pw);
  }
  return {f, c};
}
int main() {
  build_sieve();
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> v[i];
  map<vector<pair<int, int>>, int> s;
  long long count = 0;
  for (int i = 1; i <= n; i++) {
    auto pvv = divisors_of(v[i]);
    if (s.count(pvv.second)) {
      count += s[pvv.second];
    }
    s[pvv.first]++;
  }
  cout << count << '\n';
  return 0;
}
