#include <bits/stdc++.h>
using namespace std;
const long long tam = 100200;
const long long MOD = 1e9 + 7;
const long long MOD1 = 988244535;
const double EPS = 1e-9;
const double PI = acos(-1);
map<int, int> mimapa[tam];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  int valor;
  for (long long j = 0; j < n; j++) {
    cin >> valor;
    for (int i = 2; i * i <= valor; i++) {
      int c = 0;
      while (valor % i == 0) {
        c++;
        valor /= i;
      }
      c %= k;
      if (c != 0) mimapa[j][i] = c;
    }
    if (valor != 1) mimapa[j][valor] = 1;
  }
  map<int, int> otromapa;
  map<map<int, int>, int> mapas;
  long long tot = 0;
  for (long long j = 0; j < n; j++) {
    otromapa.clear();
    for (auto ite = mimapa[j].begin(); ite != mimapa[j].end(); ite++) {
      otromapa[ite->first] = k - ite->second;
    }
    tot += mapas[otromapa];
    mapas[mimapa[j]]++;
  }
  cout << tot << endl;
}
