#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  fast();
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  vector<bool> is(1e5 + 1, false);
  vector<vector<int> > pr(1e5 + 1);
  long long kol1 = 0;
  long long kol = 0;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    if (A[i] == 1) kol1++;
    is[A[i]] = true;
  }
  vector<bool> pro(1e5 + 1, true);
  for (int i = 2; i < pro.size(); i++) {
    if (!pro[i]) {
      continue;
    }
    if (is[i]) {
      pr[i].push_back(i);
    }
    for (int j = i * 2; j < pro.size(); j += i) {
      pro[j] = false;
      if (is[j]) {
        pr[j].push_back(i);
      }
    }
  }
  map<vector<pair<int, int> >, int> F;
  for (int i = 0; i < A.size(); i++) {
    int x = A[i];
    if (x == 1) continue;
    vector<pair<int, int> > T;
    for (int j = 0; j < pr[A[i]].size(); j++) {
      long long st = 0;
      while (x % pr[A[i]][j] == 0) {
        st++;
        x /= pr[A[i]][j];
      }
      if (st == 0) continue;
      if (st % k == 0) continue;
      T.push_back({pr[A[i]][j], st % k});
    }
    if (T.size() == 0) {
      kol1++;
      continue;
    }
    vector<pair<int, int> > T1 = T;
    for (int j = 0; j < T.size(); j++) {
      T1[j].second = (k - T1[j].second) % k;
    }
    kol += F[T1];
    F[T]++;
  }
  cout << kol + kol1 * (kol1 - 1) / 2;
}
