#include <bits/stdc++.h>
using namespace std;
int a[100009], c[100009], b[100009], d[100009];
long long ksm(long long a, long long n, long long d) {
  long long ans;
  ans = 1;
  while (n > 0) {
    if (n % 2 == 1) ans = (ans * a) % d;
    a = a * a % d;
    n = n / 2;
  }
  return ans % d;
}
long long ksm2(long long a, long long n) {
  long long ans;
  ans = 1;
  while (n > 0) {
    if (n % 2 == 1) {
      if (a > 1e5) return 0;
      ans = ans * a;
    }
    if (ans > 1e5) return 0;
    if (a > 1e5) return 0;
    a = a * a;
    n = n / 2;
  }
  return ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    c[i] = 1;
    b[i] = 1;
    int gg = a[i];
    for (int j = 2; j <= sqrt(gg); j++)
      if (a[i] % j == 0) {
        int g = 0;
        while (a[i] % j == 0) {
          g++;
          a[i] /= j;
        }
        g = g % k;
        b[i] *= ksm(j, g, 1e18 + 9);
        c[i] *= ksm2(j, (k - g) % k);
      }
    if (a[i] != 1) {
      b[i] *= a[i];
      c[i] *= ksm2(a[i], k - 1);
    }
    d[b[i]]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (c[i] != 0) {
      ans += d[c[i]];
      if (c[i] == b[i]) ans--;
    }
  }
  ans /= 2;
  cout << ans << endl;
  return 0;
}
