#include <bits/stdc++.h>
using namespace std;
long long k;
long long make(long long n) {
  long long m = n;
  for (long long i = 2; i <= sqrt(n); i++) {
    long long kolvo = 0;
    while (n % i == 0) {
      n /= i;
      kolvo++;
    }
    kolvo -= (kolvo % k);
    for (long long j = 0; j < kolvo; j++) m /= i;
  }
  return m;
}
long long dop(long long n) {
  long long m = 1;
  for (long long i = 2; i <= sqrt(n); i++) {
    long long kolvo = k;
    if (n % i != 0) continue;
    while (n % i == 0) {
      n /= i;
      kolvo--;
    }
    if (kolvo == k) continue;
    for (long long j = 0; j < kolvo; j++) {
      m *= i;
      if (m > 100000) return -1;
    }
  }
  if (n == 1) return m;
  long long kolvo = k - 1;
  for (long long i = 0; i < kolvo; i++) {
    m *= n;
    if (m > 100000) return -1;
  }
  return m;
}
int32_t main() {
  long long n;
  cin >> n >> k;
  vector<long long> a(n);
  vector<long long> b(n);
  for (long long i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    tmp = make(tmp);
    a[i] = tmp;
    b[i] = dop(tmp);
  }
  map<long long, long long> was;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += was[b[i]];
    was[a[i]]++;
  }
  cout << ans;
  return 0;
}
