#include <bits/stdc++.h>
using namespace std;
long long powe(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = (ans * a);
    n = n / 2;
    a = (a * a);
    if (ans > 100000) return 0;
  }
  return ans;
}
long long dp[100002];
long long fun(long long n) {
  if (n > (n / 2 + n / 3 + n / 4)) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long a;
    map<long long, long long> mp;
    long long ans = 0;
    for (long long i = 0; i < (n); ++i) {
      cin >> a;
      long long temp = a;
      long long req = 1, res = 1;
      for (int j = 2; j * j <= a; j++) {
        if (temp % j != 0) continue;
        long long cn = 0;
        while (temp % j == 0) {
          cn++;
          temp = temp / j;
        }
        cn = cn % k;
        if (cn != 0) req *= powe(j, k - cn);
        res *= powe(j, cn);
      }
      if (temp != 1) {
        res *= temp;
        req *= powe(temp, k - 1);
      }
      if (req != 0) ans += mp[req];
      mp[res]++;
    }
    cout << ans << '\n';
  }
}
