#include <bits/stdc++.h>
using namespace std;
long long shin[25];
long long seto(void);
void ayano(long long x, char spliter = '\n');
int minp[100005] = {0};
int prime[100005], pr = 0;
int a[100005];
int mxdg[100005];
map<long long, int> st;
void make_p(int n);
long long kasumi(long long a, long long b);
int main(void) {
  make_p(100000);
  int n, k;
  long long ans = 0;
  n = seto(), k = seto();
  for (int i = 1; i <= n; i++) a[i] = seto();
  mxdg[1] = 0;
  for (int i = 2; i <= 100000; i++) {
    int tans = 1;
    long long tx = i;
    while (tx * i <= 100000) tans++, tx *= i;
    mxdg[i] = tans;
  }
  for (int i = 1; i <= n; i++) {
    long long x = a[i];
    long long y = 1;
    long long u = 1;
    int uok = 1;
    while (x > 1) {
      int tdeg = 0;
      int tminp = minp[x];
      while (minp[x] == tminp) x /= tminp, tdeg++;
      tdeg %= k;
      y *= kasumi(tminp, tdeg);
      int udeg;
      udeg = (k - tdeg) % k;
      if (udeg > mxdg[tminp])
        uok = 0;
      else
        u *= kasumi(tminp, udeg);
    }
    (uok && st.count(u)) ? (ans += st[u]) : (0);
    if (st.count(y))
      st[y]++;
    else
      st[y] = 1;
  }
  ayano(ans);
  return 0;
}
void make_p(int n) {
  int nd2 = n >> 1;
  minp[1] = 0;
  for (int i = 2; i <= n; i++) {
    if (!minp[i]) {
      minp[i] = i;
      prime[pr++] = i;
    }
    int t;
    for (int j = 0; j < pr && (t = prime[j] * i) <= n; j++) {
      minp[t] = prime[j];
      if (prime[j] == minp[i]) break;
    }
  }
}
long long kasumi(long long a, long long b) {
  long long ans = 1;
  while (b) {
    (b & 1) ? (ans *= a) : (0);
    a *= a, b >>= 1;
  }
  return ans;
}
long long seto(void) {
  long long x = 0;
  char ch = getchar();
  int symbol = 0;
  while (!isdigit(ch)) (ch == '-') ? (symbol = 1) : (0), ch = getchar();
  while (isdigit(ch)) x = (x * 10) + (ch - '0'), ch = getchar();
  return (symbol) ? (-x) : (x);
}
void ayano(long long x, char spliter) {
  if (!x) {
    putchar('0'), putchar(spliter);
    return;
  }
  if (x < 0) putchar('-'), x = -x;
  int len = 0;
  while (x) {
    long long d = x / 10;
    shin[len++] = x - d * 10;
    x = d;
  }
  while (len--) putchar(shin[len] + '0');
  putchar(spliter);
}
