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