#include <bits/stdc++.h>
inline int getint() {
  int x = 0, p = 1;
  char c = getchar();
  while (c <= 32) c = getchar();
  if (c == 45) p = -p, c = getchar();
  while (c > 32) x = x * 10 + c - 48, c = getchar();
  return x * p;
}
using namespace std;
const int N = 2e5 + 5;
int n, k, cnt[N];
long long res;
int main() {
  n = getint();
  k = getint();
  for (int(i) = 0; (i) < (n); (i)++) {
    int x = getint(), px = 1;
    long long py = 1;
    bool flag = true;
    for (int j = 2; j * j <= x; j++)
      if (x % j == 0) {
        int c = 0;
        while (x % j == 0) x /= j, ++c;
        c %= k;
        for (int(ii) = 0; (ii) < (c); (ii)++) px *= j;
        if (c)
          for (int(ii) = 0; (ii) < (k - c); (ii)++) {
            py *= j;
            if (py >= N) flag = false;
          }
      }
    if (x > 1) {
      px *= x;
      for (int(ii) = 0; (ii) < (k - 1); (ii)++) {
        py *= x;
        if (py >= N) flag = false;
      }
    }
    if (flag) res += cnt[py];
    cnt[px]++;
  }
  cout << res << endl;
  return 0;
}
