#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<pair<int, int>> vp[n];
  map<vector<pair<int, int>>, int> mvpi;
  for (int i = 0; i < n; i++) {
    int num = a[i];
    for (int j = 2; j * j <= num; j++) {
      if (num % j == 0) {
        int p = 0;
        while (num % j == 0) {
          num /= j;
          p++;
        }
        if (p % k > 0) {
          vp[i].push_back({j, p % k});
        }
      }
    }
    if (num > 1) {
      vp[i].push_back({num, 1});
    }
    mvpi[vp[i]]++;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    vector<pair<int, int>> rem;
    for (auto p : vp[i]) {
      rem.push_back({p.first, k - p.second});
    }
    ans += mvpi[rem];
    if (rem == vp[i]) ans--;
  }
  ans /= 2;
  cout << ans << endl;
  return 0;
}
