#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
const ll INF = 1e18 + 9;
using pi = pair<int, int>;
ll powmod(ll base, ll exp, const ll MOD) {
  ll ans = 1;
  while (exp) {
    if (exp & 1) ans = (ans * base) % MOD;
    base = (base * base) % MOD;
    exp >>= 1;
  }
  return ans;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }
const int mxN = 1e6;
void test_case() {}
int popcount(ll x) {
  int ans = 0;
  for (int i = 0; i < 64; ++i) ans += (x >> i) & 1LL;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, k;
  cin >> n >> k;
  map<vector<pi>, int> mp;
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    vector<pi> v, w;
    for (int p = 2; p * p <= a; ++p) {
      int r = 0;
      while (a % p == 0) {
        a /= p;
        ++r;
      }
      r %= k;
      if (r > 0) {
        v.push_back({p, r});
        w.push_back({p, k - r});
      }
    }
    if (a > 1) {
      v.push_back({a, 1});
      if (k > 1) w.push_back({a, k - 1});
    }
    ans += mp[w];
    mp[v]++;
  }
  cout << ans;
  return 0;
}
