#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, k;
long long ans;
vector<pair<int, int> > a, b;
map<vector<pair<int, int> >, int> mp;
int main() {
  scanf("%d%d", &n, &k);
  register int i, j, x;
  for (i = 1; i <= n; ++i) {
    scanf("%d", &x);
    for (j = 2; j * j <= x; ++j)
      if (!(x % j)) {
        register int cnt = 0;
        while (!(x % j)) x /= j, ++cnt;
        cnt %= k;
        if (cnt)
          a.push_back(make_pair(j, cnt)), b.push_back(make_pair(j, k - cnt));
      }
    if (x > 1) a.push_back(make_pair(x, 1)), b.push_back(make_pair(x, k - 1));
    ans += mp[b], ++mp[a], a.clear(), b.clear();
  }
  printf("%lld", ans);
  return 0;
}
