#include <bits/stdc++.h>
using namespace std;
long long pow(long long a, long long n) {
  if (n == 0) return 1;
  return pow(a, n / 2) * pow(a, n / 2) * pow(a, n % 2);
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<long long> a(n);
  map<long long, long long> m, m1;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    long long cnt1 = 1, cnt2 = 1;
    long long k1 = a[i];
    for (long long j = 2; j * j <= a[i]; ++j) {
      int cnt = 0;
      while (k1 % j == 0) {
        cnt++;
        k1 /= j;
      }
      cnt1 *= pow(j, cnt % k);
      if (cnt % k > 0) cnt2 *= pow(j, k - cnt % k);
    }
    if (k1 > 0) {
      cnt1 *= pow(k1, 1);
      cnt2 *= pow(k1, k - 1);
    }
    m[cnt1]++;
    m1[cnt1] = cnt2;
  }
  long long ans = 0;
  for (const auto& elem : m) {
    int cnt1 = elem.first;
    int cnt2 = m1[cnt1];
    if (cnt1 == cnt2)
      ans += m[cnt1] * (m[cnt1] - 1);
    else
      ans += m[cnt1] * m[cnt2];
  }
  cout << ans / 2 << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
