#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
const long long N = 1e5 + 5;
long long n, k, a[N], ans;
map<long long, long long> sp;
void solve() {
  cin >> n >> k;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  for (long long i = 1; i <= n; ++i) {
    vector<pair<long long, long long>> v;
    for (long long j = 2; j * j <= a[i]; ++j) {
      if (a[i] % j != 0) continue;
      long long cnt = 0;
      while (a[i] % j == 0) {
        ++cnt;
        a[i] /= j;
      }
      v.push_back({j, cnt % k});
    }
    if (a[i] != 1) v.push_back({a[i], 1});
    long long vv = 1;
    bool f = 0;
    set<long long> Q;
    long long gg = 1;
    for (auto d : v) {
      Q.insert(d.first);
      for (long long j = 1; j <= d.second; ++j) {
        vv *= d.first;
      }
      for (long long j = 1; j <= (k - d.second) % k; ++j) {
        gg *= d.first;
        if (gg > (long long)1e5) {
          f = 1;
          break;
        }
      }
    }
    if (f) continue;
    ans += sp[gg];
    ++sp[vv];
  }
  cout << ans;
}
