#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-10;
const ld PI = acos(-1);
vector<ll> po[2];
ll n, k;
pair<ll, ll> CountHash(ll x, ll ind, ll q) {
  ll h1 = 0, h2 = 0;
  for (ll i = 2; i * i <= x; ++i) {
    if (x % i == 0) {
      ll a = 0;
      while (x % i == 0) {
        ++a;
        x /= i;
      }
      a %= k;
      ll b = (k - a) % k;
      h1 += a * po[ind][i] % q;
      h2 += b * po[ind][i] % q;
      h1 %= q;
      h2 %= q;
    }
  }
  if (x > 1) {
    h1 += 1 * po[ind][x] % q;
    h2 += (k - 1) * po[ind][x] % q;
    h1 %= q;
    h2 %= q;
  }
  return {h1, h2};
}
void solve() {
  cin >> n >> k;
  map<pair<ll, ll>, ll> cnt;
  ll P1 = 239;
  ll Q1 = 1e9 + 7;
  ll P2 = 41;
  ll Q2 = 1e9 + 9;
  po[0].resize(100000);
  po[1].resize(100000);
  po[0][0] = 1;
  po[1][0] = 1;
  for (int i = 1; i < 100000; ++i) {
    po[0][i] = po[0][i - 1] * P1 % Q1;
    po[1][i] = po[1][i - 1] * P2 % Q2;
  }
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    ll x;
    cin >> x;
    auto h1 = CountHash(x, 0, Q1);
    auto h2 = CountHash(x, 1, Q2);
    ans += cnt[{h1.second, h2.second}];
    ++cnt[{h1.first, h2.first}];
  }
  cout << ans << "\n";
}
int main() {
  solve();
  return 0;
}
