#include <bits/stdc++.h>
const long long MAX = 10000000000;
using namespace std;
long long pw(long a, int n) {
  long long res = 1;
  for (int i = 0; i < n; i++) {
    res *= a;
    if (res > MAX) return res;
  }
  return res;
}
int main() {
  long p, n, d, t, k, count, q;
  long long res = 0;
  cin >> n >> k;
  vector<pair<long, long> > a;
  vector<pair<long, long> > b;
  map<vector<pair<long, long> >, long>::iterator it;
  map<vector<pair<long, long> >, long> myMap;
  for (int i = 0; i < n; i++) {
    a.clear();
    b.clear();
    cin >> t;
    p = 2;
    while (t != 1) {
      while (t % p != 0 && p <= sqrt(t)) p++;
      if (p > sqrt(t)) {
        a.insert(a.cend(), make_pair(t, 1));
        t = 1;
        break;
      }
      count = 0;
      while (t % p == 0) {
        count++;
        t /= p;
      }
      count %= k;
      if (count != 0) a.insert(a.cend(), make_pair(p, count));
      p++;
    }
    for (auto f : a) b.insert(b.cend(), make_pair(f.first, k - f.second));
    it = myMap.find(b);
    if (it != myMap.cend()) res += it->second;
    myMap[a]++;
  }
  cout << res << endl;
  return 0;
}
