#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> vec(n);
  vector<pair<long long, long long>> a, b;
  map<vector<pair<long long, long long>>, long long> ma;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    cin >> vec[i];
    long long num = vec[i];
    for (long long j = 2; j <= sqrt(vec[i]); j++) {
      long long count = 0;
      while (num % j == 0) {
        count++;
        num /= j;
      }
      if (count % k) a.push_back(make_pair(j, count % k));
    }
    if (num > 1) a.push_back(make_pair(num, 1));
    for (long long i = 0; i < a.size(); i++) {
      b.push_back(make_pair(a[i].first, k - a[i].second));
    }
    ans += ma[b];
    ma[a]++;
    a.clear();
    b.clear();
  }
  cout << ans << endl;
}
