#include <bits/stdc++.h>
using namespace std;
long long modinverse(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m, t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long mod_pow(long long a, long long n, long long p) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = (ans * a) % p;
    a = (a * a) % p;
    n >>= 1;
  }
  return ans;
}
long long prime_mod_pow(long long a, long long n, long long p) {
  long long ans = 1;
  n %= p - 1;
  while (n) {
    if (n & 1) ans = (ans * a) % p;
    a = (a * a) % p;
    n >>= 1;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long ext_gcd(long long l, long long r, long long &x, long long &y) {
  if (l == 0) {
    x = 0;
    y = 1;
    return r;
  }
  long long x1, y1, g;
  g = ext_gcd(r % l, l, x1, y1);
  x = y1 - (r / l) * x1;
  y = x1;
  return g;
}
const long long dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long long ok(long long x, long long y, long long n, long long m) {
  return (x >= 0 and y >= 0 and x < n and y < m);
}
long long num_div;
map<long long, long long> pr_factor;
void factorise(long long n) {
  long long count = 0;
  while (!(n % 2)) {
    n >>= 1;
    count++;
  }
  if (count) num_div *= (count + 1);
  pr_factor[2] = count;
  for (long long i = 3; i <= sqrt(n); i += 2) {
    count = 0;
    while (n % i == 0) {
      count++;
      n /= i;
    }
    if (count) num_div *= (count + 1);
    pr_factor[i] = count;
  }
  if (n > 2) num_div *= 2;
  pr_factor[n] = 1;
}
long long make(long long a, long long k) {
  long long o = 1;
  bool f = true;
  for (long long i = 2; i <= sqrt(a); i++) {
    if (a % i == 0) {
      long long cnt = 0;
      while (a % i == 0) {
        cnt++;
        a /= i;
      }
      cnt = k - cnt;
      for (long long j = 0; j < cnt; j++) {
        o *= i;
        if (o > (long long)1e5) {
          f = false;
          break;
        }
      }
      if (!f) break;
    }
  }
  if (!f) return -1;
  if (a != 1) {
    long long cnt = k - 1;
    for (long long i = 0; i < cnt; i++) {
      o *= a;
      if (o > (long long)1e5) {
        f = false;
        break;
      }
    }
  }
  if (!f) return -1;
  return o;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  map<long long, long long> ma;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    long long p, o = 1;
    cin >> p;
    for (long long i = 2; i <= sqrt(p); i++) {
      if (p % i == 0) {
        long long cnt = 0;
        while (p % i == 0) {
          cnt++;
          p /= i;
        }
        cnt %= k;
        o *= pow(i, cnt);
      }
    }
    if (p != 1) o *= p;
    a[i] = o;
  }
  sort(a.begin(), a.end());
  for (long long i = 0; i < n; i++) ma[a[i]]++;
  long long ans = 0;
  for (auto i : ma) {
    long long q = make(i.first, k);
    if (!ma.count(q) or q < i.first) continue;
    if (q > i.first) {
      ans += (i.second) * (ma[q]);
    } else {
      ans += ((i.second) * (i.second - 1)) / 2;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  int tc = 1;
  while (t--) {
    solve();
    tc++;
  }
}
