#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000000 + 7;
long long powe(long long x, long long y) {
  x = x % mod, y = y % (mod - 1);
  long long ans = 1;
  while (y > 0) {
    if (y & 1) {
      ans = (1ll * x * ans) % mod;
    }
    y >>= 1;
    x = (1ll * x * x) % mod;
  }
  return ans;
}
void fun() {}
signed main() {
  fun();
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, k, num;
  long long sum = 1;
  cin >> n >> k;
  long long a[100001] = {};
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  map<long long, long long> mp;
  for (long long i = 1; i <= n; i++) {
    num = a[i];
    sum = 1;
    long long sum1 = 1;
    for (long long j = 2; j * j <= num; j++) {
      long long cnt = 0;
      while (num % j == 0) {
        num /= j;
        cnt++;
      }
      if (cnt != k) cnt %= k;
      sum *= pow(j, (k - cnt) % k);
      sum1 *= pow(j, cnt % k);
    }
    if (num != 1) {
      sum *= pow(num, k - 1);
      sum1 *= pow(num, 1);
    }
    ans += mp[sum];
    mp[sum1]++;
  }
  cout << ans << "\n";
}
