#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0;
  bool flg = false;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') flg = true;
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return flg ? -x : x;
}
const int INF = 1e5 + 5;
int qpow(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) {
      if (res > INF / x) return INF;
      res *= x;
    }
    y >>= 1;
    if (!y) break;
    if (x > INF / x)
      x = INF;
    else
      x *= x;
  }
  return res;
}
int n, m = 1e5, k;
int c[100010];
int work(int x) {
  static int p[110], c[110];
  int top = 0;
  for (int i = 2; i * i <= x; ++i)
    if (x % i == 0) {
      p[++top] = i, c[top] = 0;
      while (x % i == 0) x /= i, ++c[top];
    }
  if (x ^ 1) p[++top] = x, c[top] = 1;
  int z = 1;
  for (int i(1), _i(top); i <= _i; i++) {
    if (c[i] % k == 0) continue;
    c[i] %= k;
    int w = qpow(p[i], k - c[i]);
    if (z > INF / w) return INF;
    z *= w;
  }
  return z;
}
void solve() {
  n = read(), k = read();
  for (int i(1), _i(n); i <= _i; i++) ++c[read()];
  long long z = 0;
  for (int i(1), _i(m); i <= _i; i++) {
    int t = work(i);
    if (t > m) continue;
    int lim = pow(m / t, 1.0 / k) + 1e-8;
    for (int j(1), _j(lim); j <= _j; j++) {
      const int w = t * qpow(j, k);
      if (w == i) z += 1LL * c[i] * (c[i] - 1) / 2;
      if (w <= i) continue;
      z += 1LL * c[i] * c[w];
    }
  }
  printf("%lld\n", z);
}
int main() {
  for (int T = 1; T--;) solve();
  return 0;
}
