#include <bits/stdc++.h>
using namespace std;
map<vector<pair<int, int> >, int> cnt;
int n, k, x;
long long s;
void decomp(int x, vector<pair<int, int> > &p, vector<pair<int, int> > &q) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      int c = 0;
      while (x % i == 0) {
        c++;
        x /= i;
      }
      if (c % k) {
        p.push_back(make_pair(i, c % k));
        q.push_back(make_pair(i, k - c % k));
      }
    }
  }
  if (x > 1) {
    p.push_back(make_pair(x, 1));
    q.push_back(make_pair(x, k - 1));
  }
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    vector<pair<int, int> > p, q;
    decomp(x, p, q);
    s += cnt[q];
    ++cnt[p];
  }
  cout << s;
}
