#include <bits/stdc++.h>
using namespace std;
signed main() {
  map<vector<pair<long long int, long long int>>, long long int> mp;
  vector<pair<long long int, long long int>> v1, v2;
  long long int n, k;
  cin >> n >> k;
  long long int a[n + 5];
  long long int ans = 0;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
    long long int temp = a[i], cnt = 0;
    for (long long int j = 2; j * j <= temp; j++) {
      cnt = 0;
      while (temp % j == 0) {
        cnt++;
        temp = temp / j;
      }
      if (cnt % k) {
        v1.push_back(make_pair(j, cnt % k));
      }
    }
    if (temp > 1) {
      v1.push_back(make_pair(temp, 1));
    }
    for (long long int i = 0; i < v1.size(); i++) {
      v2.push_back(make_pair(v1[i].first, k - v1[i].second));
    }
    ans = ans + mp[v2];
    mp[v1]++;
    v1.clear();
    v2.clear();
  }
  cout << ans << endl;
  return 0;
}
