#include <bits/stdc++.h>
using namespace std;
const long long int N = 2e5 + 1;
long long int binpow(long long int a, long long int b) {
  long long int res = 1;
  while (b) {
    if (res > 100000 || a > 100000) return -1;
    if (b & 1) res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, k;
  cin >> n >> k;
  long long int a[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  map<long long int, long long int> mp, cnt;
  for (long long int i = 0; i < n; i++) {
    long long int temp = a[i];
    long long int value = 1;
    for (long long int j = 2; j * j <= temp; j++)
      if (temp % j == 0) {
        long long int cnt = 0;
        while (temp % j == 0) temp /= j, cnt++;
        value *= binpow(j, cnt % k);
      }
    if (temp > 1) value *= temp;
    a[i] = value;
    mp[a[i]]++;
  }
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    long long int temp = a[i];
    long long int value = 1;
    for (long long int j = 2; j * j <= temp; j++)
      if (temp % j == 0) {
        long long int cnt = 0;
        while (temp % j == 0) temp /= j, cnt++;
        value *= binpow(j, k - (cnt % k));
        if (value > 100000 || value < 0) {
          value = -1;
          temp = 0;
          break;
        }
      }
    if (temp > 1) value *= binpow(temp, k - 1);
    if (value == a[i]) {
      cnt[value]++;
      continue;
    }
    ans += mp[value];
    mp[a[i]]--;
  }
  for (auto i : cnt) ans += (i.second * (i.second - 1)) / 2;
  cout << ans;
  return 0;
}
