#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, k, cnt, p[N], vis[N];
long long ans;
map<vector<pair<int, int> >, int> mp;
void init(int n) {
  for (int i = (2); i <= (n); i++) {
    if (!vis[i]) p[++cnt] = i, vis[i] = i;
    for (int j = 1; j <= cnt && p[j] * i <= n; j++) {
      vis[i * p[j]] = p[j];
      if (i % p[j] == 0) continue;
    }
  }
}
int main() {
  init(100000);
  scanf("%d%d", &n, &k);
  for (int i = (1); i <= (n); i++) {
    int x, y;
    scanf("%d", &x);
    vector<pair<int, int> > q;
    while (x != 1) {
      y = vis[x];
      int t = 0;
      while (x % y == 0) x /= y, t++;
      t %= k;
      if (t) q.push_back(pair<int, int>(y, t));
    }
    sort(q.begin(), q.end());
    ans += mp[q];
    for (int j = (0); j <= ((int)q.size() - 1); j++)
      q[j].second = (k - q[j].second) % k;
    mp[q]++;
  }
  printf("%lld\n", ans);
  return 0;
}
