#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000"]
#pragma GCC optimize("Ofast"]
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native"]
using namespace std;
long long int n, k;
map<vector<pair<long long int, long long int>>, long long int> mp;
vector<pair<long long int, long long int>> get(long long int num) {
  vector<pair<long long int, long long int>> pr;
  for (long long int i = 2; i * i <= num; i++) {
    long long int cnt = 0;
    while (num % i == 0) {
      cnt++;
      num /= i;
    }
    if (cnt % k > 0) pr.push_back({i, cnt % k});
  }
  if (num > 1) {
    pr.push_back({num, 1});
    num /= num;
  }
  sort(pr.begin(), pr.end());
  return pr;
}
signed main() {
  cin >> n >> k;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  mp[get(a[0])]++;
  long long int ans = 0;
  for (long long int i = 1; i < n; i++) {
    long long int num = a[i];
    auto pr = get(num);
    vector<pair<long long int, long long int>> pr2;
    for (auto& i : pr) {
      if ((k - i.second) % k > 0) pr2.push_back({i.first, k - i.second});
    }
    ans += mp[pr2];
    mp[pr]++;
  }
  cout << ans;
  return 0;
}
