#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  map<vector<pair<int, int>>, int> mp;
  for (int i = 0; i < n; i++) {
    vector<pair<int, int>> v;
    int temp = a[i];
    for (int j = 2; j * j <= temp; j++) {
      if (temp % j == 0) {
        int cnt = 0;
        while (temp % j == 0) {
          temp = temp / j;
          cnt++;
        }
        if (cnt % k != 0) {
          v.push_back({j, cnt % k});
        }
      }
    }
    if (temp > 1) {
      v.push_back({temp, 1});
    }
    if (v.size() == 0) {
      v.push_back({0, 0});
    }
    sort(v.begin(), v.end());
    mp[v]++;
  }
  long long int ans = 0;
  long long int ans1 = 0;
  for (auto x : mp) {
    long long int val = x.second;
    vector<pair<int, int>> vp;
    bool ok = false;
    for (auto y : x.first) {
      vp.push_back({y.first, (k - y.second) % k});
      int v1 = (k - y.second) % k;
      int v2 = (y.second) % k;
      if (v1 != v2) {
        ok = true;
      }
    }
    if (ok == false) {
      ans = ans + (val * 1ll * (val - 1)) / 2;
    } else {
      long long int cnt = 0;
      if (mp.find(vp) != mp.end()) {
        cnt = mp[vp];
      }
      ans1 = ans1 + x.second * 1ll * cnt;
    }
  }
  cout << ans + (ans1 / 2) << "\n";
}
