#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long& i : a) cin >> i;
  vector<vector<pair<long long, long long>>> need(n), cur(n);
  for (long long i = 0; i < n; ++i) {
    for (long long j = 2; j * j <= a[i]; ++j) {
      if (a[i] % j == 0) {
        need[i].push_back({j, 0});
        while (a[i] % j == 0) {
          need[i].back().second++;
          a[i] /= j;
        }
        need[i].back().second %= k;
        if (need[i].back().second == 0) need[i].pop_back();
      }
    }
    if (a[i] > 1) {
      need[i].push_back({a[i], 1});
    }
    for (auto elem : need[i]) {
      cur[i].push_back({elem.first, k - elem.second});
    }
    sort(need[i].begin(), need[i].end());
    sort(cur[i].begin(), cur[i].end());
  }
  map<vector<pair<long long, long long>>, long long> m1;
  for (auto elem : cur) {
    m1[elem]++;
  }
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    if (need[i] == cur[i]) {
      ans += m1[need[i]] - 1;
    } else
      ans += m1[need[i]];
  }
  cout << ans / 2;
}
