#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long lpf[100005], cnt[100005] = {0};
  for (long long i = 1; i < 100005; i++) lpf[i] = i;
  for (long long i = 2; i < 100005; i++)
    if (lpf[i] == i)
      for (long long j = 2 * i; j < 100005; j += i)
        if (lpf[j] == j) lpf[j] = i;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    long long res = 1, rem = 1;
    while (x > 1) {
      long long c = 0;
      long long fac = lpf[x];
      while (x % fac == 0) {
        c++;
        x /= fac;
      }
      c %= k;
      for (long long j = 0; j < c; j++) res *= fac;
      for (long long j = 0; j < (k - c) % k; j++) {
        rem *= fac;
        rem = min(rem, 100005 - 1LL);
      }
    }
    ans += cnt[rem];
    cnt[res]++;
  }
  cout << ans << endl;
  return 0;
}
