#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> v;
long long tim[100001];
bool nprime[401];
vector<long long> pr;
long long po(long long a, long long nn) {
  long long res = 1;
  long long aa = a;
  while (nn) {
    if (aa > 100000) return -1;
    if (nn & 1) {
      res *= aa;
      if (res > 100000) return -1;
    }
    aa *= aa;
    nn /= 2;
  }
  return res;
}
int main() {
  for (int i = 2; i < 401; i++) {
    if (!nprime[i]) {
      pr.push_back(i);
      for (int j = i + i; j < 401; j += i) {
        nprime[j] = true;
      }
    }
  }
  scanf("%lld%lld", &n, &k);
  v.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &v[i]);
    tim[v[i]]++;
  }
  if (k >= 34) {
    printf("%lld\n", tim[1] * (tim[1] - 1) / 2LL);
    return 0;
  }
  long long ans = 0;
  vector<long long> left;
  for (int i = 0; i < n; i++) {
    tim[v[i]]--;
    long long sea = 1;
    for (int j = 0; j < pr.size(); j++) {
      long long cnt = 0;
      while (!(v[i] % pr[j])) {
        v[i] /= pr[j];
        cnt++;
      }
      cnt %= k;
      long long P = po(pr[j], (k - cnt) % k);
      if (P == -1) {
        sea = -1;
        break;
      }
      sea *= P;
    }
    if (sea == -1) continue;
    if (k != 2 && v[i] != 1) continue;
    if (k == 2 && v[i] != 1) sea *= v[i];
    if (sea > 100000) continue;
    long long st = 1;
    while (sea * po(st, k) <= 100000) {
      if (po(st, k) < 0) break;
      ans += tim[sea * po(st, k)];
      st++;
    }
  }
  printf("%lld\n", ans);
}
