#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, int>> factorize(long long x) {
  vector<pair<long long, int>> V;
  for (long long i = 2; i * i <= x; ++i) {
    if (x % i) continue;
    int t = 0;
    while (x % i == 0) x /= i, ++t;
    V.emplace_back(i, t);
  }
  if (x > 1) V.emplace_back(x, 1);
  return V;
}
long long power(long long x, int t) {
  long long ret = 1;
  while (t > 0) {
    if (t & 1) ret *= x;
    x *= x;
    t >>= 1;
  }
  return ret;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  map<long long, int> M;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    auto P = factorize(a);
    long long t = 1, s = 1;
    for (auto p : P) {
      t *= power(p.first, p.second % k);
      s *= power(p.first, (k - p.second % k) % k);
    }
    ans += M[s];
    ++M[t];
  }
  cout << ans << endl;
}
