#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
map<int, int> gg(int x) {
  map<int, int> ans;
  ans.clear();
  for (long long i = 2; i * i <= x; i++) {
    while (x % i == 0) {
      x /= i;
      ans[i]++;
    }
  }
  if (x != 1) {
    ans[x]++;
  }
  return ans;
}
map<map<int, int>, int> qaq;
int main() {
  qaq.clear();
  int n, k;
  scanf("%d%d", &n, &k);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    map<int, int> f = gg(x);
    map<int, int> g;
    g.clear();
    vector<int> z;
    for (map<int, int>::iterator it = f.begin(); it != f.end(); ++it) {
      it->second %= k;
      if (it->second != 0) {
        g[it->first] = (k - it->second) % k;
      } else {
        z.push_back(it->first);
      }
    }
    for (vector<int>::iterator it = z.begin(); it != z.end(); ++it) {
      f.erase(*it);
    }
    ans += qaq[g];
    qaq[f] += 1;
  }
  cout << ans << endl;
  return 0;
}
