#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getrnd(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }
template <typename T1, typename T2>
bool relax(T1& a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
bool strain(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  map<list<pair<int, int>>, int> cnt;
  vector<list<pair<int, int>>> fact(n);
  for (int i = 0; i < n; ++i) {
    int x = a[i];
    for (int d = 2; d * d <= x; ++d) {
      int c = 0;
      while (x % d == 0) x /= d, ++c;
      if (c % k != 0) fact[i].emplace_back(d, c % k);
    }
    if (x != 1) fact[i].emplace_back(x, 1);
    cnt[fact[i]]++;
  }
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    list<pair<int, int>> nf;
    for (auto& f : fact[i]) {
      nf.emplace_back(f.first, k - f.second);
    }
    if (nf != fact[i])
      ans += cnt[nf];
    else
      ans += cnt[nf] - 1;
  }
  cout << ans / 2 << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t = 1;
  while (t--) solve();
  return 0;
}
