#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
char en = '\n';
long long inf = 1e16;
long long mod = 1e9 + 7;
long long power(long long x, long long n, long long mod) {
  long long res = 1;
  x %= mod;
  while (n) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
vector<long long> fact[N];
bool prime[N];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  memset(prime, true, sizeof(prime));
  for (long long i = 2; i < N; i++) {
    if (prime[i]) {
      for (long long j = i; j < N; j += i) {
        prime[j] = false;
        fact[j].push_back(i);
      }
    }
  }
  long long n, k;
  cin >> n >> k;
  long long cnt2 = 0;
  map<vector<long long>, map<vector<long long>, long long>> par;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    vector<long long> curr;
    vector<long long> curr2;
    long long x1 = x;
    for (long long &y : fact[x1]) {
      long long cnt = 0;
      while (x % y == 0) {
        x /= y;
        cnt++;
      }
      cnt %= k;
      if (cnt) {
        curr.push_back(y);
        curr2.push_back(cnt);
      }
    }
    if (curr.size())
      par[curr][curr2]++;
    else {
      cnt2++;
    }
  }
  long long res = 0;
  for (auto &it : par) {
    map<vector<long long>, long long> par2 = it.second;
    for (auto &it2 : par2) {
      vector<long long> req = it2.first;
      for (long long &x : req) {
        x = (k - x);
      }
      if (req == it2.first) {
        res += it2.second * (it2.second - 1);
      } else if (par2.count(req)) {
        res += it2.second * par2[req];
      }
    }
  }
  res /= 2;
  res += (cnt2 * (cnt2 - 1)) / 2;
  cout << res << en;
  return 0;
}
