#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
vector<pair<int, int> > v[N];
vector<int> prime;
bool check(int p) {
  bool ret = true;
  for (long long i = 2; i * i <= p; i++)
    if (p % i == 0) ret = false;
  return ret;
}
void solve() {
  for (int i = 2; i <= 316; i++) {
    if (check(i)) prime.push_back(i);
  }
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int in;
    cin >> in;
    for (auto p : prime) {
      int x = 0;
      while (in % p == 0) in /= p, x++;
      if (x % k) v[i].push_back({p, x % k});
    }
    if (in > 1) v[i].push_back({in, 1});
  }
  map<vector<pair<int, int> >, int> mp;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    vector<pair<int, int> > para;
    for (auto p : v[i]) {
      para.push_back({p.first, (k - p.second)});
    }
    if (mp.count(para)) ans += mp[para];
    mp[v[i]]++;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  solve();
  return 0;
}
