#include <bits/stdc++.h>
using i64 = long long;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  std::vector<i64> v;
  for (i64 i = 1, inf = 100000000; i < inf; i++) {
    i64 t = 1;
    for (int j = 0; j < k; j++) {
      t = t * i;
      if (t > 10000000000) {
        i = inf;
        goto brk;
      }
    }
    v.push_back(t);
  brk:;
  }
  std::map<i64, i64> cnt;
  for (int i = 0; i < n; i++) {
    i64 in;
    scanf("%lld", &in);
    int j = std::upper_bound(v.begin(), v.end(), in) - v.begin() - 1;
    for (; j >= 0; j--) {
      if (in % v[j]) continue;
      in /= v[j];
      break;
    }
    cnt[in]++;
  }
  i64 ret = 0;
  if (k == 2) {
    for (const auto [m, c] : cnt) {
      ret += c * (c - 1);
    }
  } else {
    for (const auto [mm, c] : cnt) {
      i64 ot = 1, m = mm;
      bool flg = true;
      for (i64 i = 2; flg && i * i <= m; i++) {
        if (m % i) continue;
        int t = 0;
        while (m % i == 0) {
          t++;
          m /= i;
        }
        for (int j = t; j < k; j++) {
          ot *= i;
          if (ot > 100000) {
            flg = false;
            break;
          }
        }
      }
      if (m > 1) {
        for (int j = 1; j < k; j++) {
          ot *= m;
          if (ot > 100000) {
            flg = false;
            break;
          }
        }
      }
      if (!flg) continue;
      if (ot == mm) {
        ret += c * (c - 1);
      } else {
        auto it = cnt.find(ot);
        if (it != cnt.end()) ret += c * it->second;
      }
    }
  }
  printf("%lld\n", ret / 2);
  return 0;
}
