#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const long long inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
int prime[maxn], vis[maxn];
vector<pair<int, int> > divi[maxn];
long long num[maxn];
int n, k;
long long ksm(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) {
      if (log10(a) + log10(ans) > 10) return -1;
      ans = ans * a;
    }
    if (log10(a) > 5) return -1;
    a = a * a;
    n >>= 1;
  }
  return ans;
}
void init() {
  num[1] = 1;
  for (int i = 2; i < maxn; i++) {
    num[i] = 1;
    if (!vis[i]) prime[++prime[0]] = i;
    for (int j = 1; j <= prime[0] && i * prime[j] < maxn; j++) {
      vis[i * prime[j]] = true;
      if (i % prime[j] == 0) break;
    }
  }
  for (int i = 2; i < maxn; ++i) {
    int now = i;
    for (int j = 1; j <= prime[0] && now >= prime[j]; ++j) {
      int cnt = 0;
      while (now % prime[j] == 0) {
        now /= prime[j];
        cnt++;
      }
      num[i] *= ksm(prime[j], (cnt + k - 1) / k * k - cnt);
      if (num[i] < 0) {
        num[i] = -1;
        break;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n >> k;
  init();
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  map<long long, int> mp;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    if (num[a[i]] == -1) continue;
    for (int j = 1;; ++j) {
      long long temp = ksm(j, k);
      if (temp == -1 || log10(temp) + log10(num[a[i]]) > 5) {
        break;
      }
      if (mp.count(temp * num[a[i]])) ans += mp[temp * num[a[i]]];
    }
    mp[a[i]]++;
  }
  cout << ans << endl;
  return 0;
}
