#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long& x : a) {
    cin >> x;
    long long nx = 1;
    for (long long i = 2; i * i <= x; i++) {
      int ds = 0;
      while (x % i == 0) {
        ds++;
        x /= i;
      }
      ds %= k;
      for (int j = 0; j < ds; j++) nx *= i;
    }
    if (x != 1) nx *= x;
    x = nx;
  }
  map<long long, int> mp;
  long long ans = 0;
  for (long long x : a) {
    long long xx = x;
    long long nx = 1;
    for (long long i = 2; i * i <= x; i++) {
      int ds = 0;
      while (x % i == 0) {
        ds++;
        x /= i;
      }
      ds = (k - ds) % k;
      for (int j = 0; j < ds; j++) {
        nx *= i;
        if (nx > 1e9) nx = -1;
      }
    }
    if (x != 1) {
      for (int j = 0; j < k - 1; j++) {
        nx *= x;
        if (nx > 1e9) nx = -1;
      }
    }
    ans += mp[nx];
    mp[xx]++;
  }
  cout << ans;
  return 0;
}
