#include <bits/stdc++.h>
using namespace std;
using VP = vector<pair<int, int> >;
const int NN = 1e5 + 1;
int flag[NN];
int a[NN];
VP b[NN];
map<VP, int> mp;
int main() {
  for (int i = 2; i < NN; i++)
    if (flag[i] == 0) {
      flag[i] = i;
      if ((long long)i * i > NN) continue;
      for (int j = i * i; j < NN; j += i)
        if (flag[j] == 0) flag[j] = i;
    }
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    int m = a[i];
    b[i].push_back({0, 0});
    while (m > 1) {
      int t = flag[m], r = 0;
      while (m % t == 0) m /= t, r++;
      r %= k;
      if (r) b[i].push_back({t, r});
    }
    sort(b[i].begin(), b[i].end());
    mp[b[i]]++;
  }
  long long ans = 0;
  VP tmp;
  for (int i = 1; i <= n; i++) {
    tmp.clear();
    tmp.push_back({0, 0});
    for (int j = 1; j < b[i].size(); j++) {
      tmp.push_back({b[i][j].first, k - b[i][j].second});
    }
    if (mp.count(tmp)) {
      ans += mp[tmp] - (b[i] == tmp);
    }
  }
  cout << ans / 2 << endl;
  return 0;
}
