#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5;
long long int spf[N];
void pr() {
  for (long long int i = 1; i < N; i++) spf[i] = i;
  for (long long int i = 4; i < N; i += 2) spf[i] = 2;
  for (long long int i = 3; i * i < N; i++) {
    if (spf[i] == i) {
      for (long long int j = i * i; j < N; j += i) {
        if (spf[j] == j) spf[j] = i;
      }
    }
  }
  return;
}
int32_t main() {
  pr();
  long long int n, k, x;
  cin >> n >> k;
  map<vector<pair<long long int, long long int> >, long long int> mp;
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    map<long long int, long long int> fct;
    while (x != 1) {
      fct[spf[x]]++;
      fct[spf[x]] %= k;
      x /= spf[x];
    }
    vector<pair<long long int, long long int> > no, cpl;
    for (auto& val : fct) {
      if (val.second) {
        no.push_back({val.first, val.second});
        cpl.push_back({val.first, k - val.second});
      }
    }
    ans += mp[cpl];
    mp[no]++;
    no.clear();
    cpl.clear();
  }
  cout << ans;
  return 0;
}
