#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
map<vector<pair<int, int> >, int> P;
int n, a[N], k, vis[N], Prime[N], cnt, minn[N];
long long ans;
void init() {
  for (int i = 2; i <= 100000; i++) {
    if (!vis[i]) Prime[++cnt] = i, minn[i] = i;
    for (int j = 1; j <= cnt && Prime[j] * i <= 100000; j++) {
      vis[i * Prime[j]] = 1;
      minn[i * Prime[j]] = Prime[j];
      if (i % Prime[j] == 0) break;
    }
  }
}
void work(int x) {
  vector<pair<int, int> > vec, vec2, vec3;
  while (x != 1) {
    int sz = vec.size();
    if (sz && vec[sz - 1].first == minn[x])
      vec[sz - 1].second++;
    else
      vec.push_back(make_pair(minn[x], 1));
    x /= minn[x];
  }
  int sz = vec.size();
  for (int i = 0; i < sz; i++) {
    vec[i].second %= k;
    if (vec[i].second != 0) {
      vec2.push_back(make_pair(vec[i].first, k - vec[i].second));
      vec3.push_back(make_pair(vec[i].first, vec[i].second));
    }
  }
  ans += P[vec2];
  sz = vec2.size();
  P[vec3]++;
}
int main() {
  scanf("%d%d", &n, &k);
  init();
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    work(x);
  }
  printf("%lld\n", ans);
  return 0;
}
