#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 2e5 + 5;
ll n, k, a[INF];
map<vector<pair<ll, ll>>, ll> m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    vector<pair<ll, ll>> v, search;
    for (ll j = 2; j * j <= a[i]; j++) {
      ll count = 0;
      while (a[i] % j == 0) {
        count++;
        a[i] /= j;
      }
      if (count % k == 0) continue;
      v.push_back(make_pair(j, count % k));
    }
    if (a[i] > 1) {
      v.push_back(make_pair(a[i], 1));
    }
    for (ll j = 0; j < v.size(); j++)
      search.push_back(make_pair(v[j].first, k - v[j].second));
    auto it = m.find(search);
    if (it != m.cend()) ans += it->second;
    m[v]++;
  }
  cout << ans;
  return 0;
}
