#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int ip[N], p[N];
inline void euler() {
  p[0] = 0;
  for (int i = 2; i <= 100000; ++i) {
    if (!ip[i]) {
      p[++p[0]] = i;
    }
    for (int j = 1; i * p[j] <= 100000 && j <= p[0]; ++j) {
      ip[i * p[j]] = 1;
      if (i % p[j] == 0) {
        break;
      }
    }
  }
}
int n, a[N], K;
map<map<int, int>, int> mp;
void init() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  long long ans = 0;
  map<int, int> sta, bb;
  int nw;
  for (int i = 1; i <= n; ++i) {
    nw = a[i];
    sta.clear();
    bb.clear();
    sta[0] = 1, bb[0] = 1;
    for (int j = 1; j <= p[0] && p[j] * p[j] <= a[i]; ++j) {
      while (nw % p[j] == 0) {
        nw /= p[j];
        ++sta[p[j]];
        sta[p[j]] %= K;
        bb[p[j]] = (K - sta[p[j]]) % K;
        if (!bb[p[j]]) {
          bb.erase(p[j]);
        }
        if (!sta[p[j]]) {
          sta.erase(p[j]);
        }
      }
    }
    if (nw > 1) {
      ++sta[nw];
      sta[nw] %= K;
      bb[nw] = (K - sta[nw]) % K;
      if (!bb[nw]) {
        bb.erase(nw);
      }
      if (!sta[nw]) {
        sta.erase(nw);
      }
    }
    ans += mp[bb];
    ++mp[sta];
  }
  printf("%lld\n", ans);
}
int main() {
  euler();
  init();
  return 0;
}
