#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a, x;
  long long ans = 0;
  map<vector<pair<int, int>>, int> mp;
  for (int i = 0; i < n; i++) {
    vector<pair<int, int>> v;
    cin >> a;
    for (int j = 2; j * j <= a; j++) {
      int pow = 0;
      while (a % j == 0) {
        a = a / j;
        pow++;
      }
      pow = pow % k;
      if (pow) {
        v.push_back({j, k - pow});
      }
    }
    if (a != 1) {
      v.push_back({a, k - 1});
    }
    ans = ans + mp[v];
    for (int i = 0; i < v.size(); i++) v[i].second = k - v[i].second;
    mp[v]++;
  }
  cout << ans << endl;
  return 0;
}
