#include <bits/stdc++.h>
const long long int MOD = 1e9 + 7;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int spf[200005];
long long int power(long long int x, long long int n) {
  long long int ans = 1;
  while (n) {
    ans = ans * x;
    if (ans > 100000) return 0;
    n--;
  }
  return ans;
  while (n) {
    if (n & 1) ans = ans * x;
    x = x * x;
    n /= 2;
  }
  return ans;
}
void preprocess() {
  for (int i = 0; i < 200005; ++i) spf[i] = i;
  for (int i = 2; i < 200005; ++i) {
    if (spf[i] == i) {
      for (int j = 2 * i; j < 200005; j += i) {
        spf[j] = min(spf[j], i);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  preprocess();
  int n, k;
  cin >> n >> k;
  std::vector<int> v(n);
  unordered_map<int, int> hash;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    int x = v[i];
    unordered_map<int, int> pf;
    while (x != 1) {
      pf[spf[x]]++;
      x = x / spf[x];
    }
    v[i] = 1;
    for (auto x : pf) v[i] = v[i] * power(x.first, x.second % k);
    hash[v[i]]++;
  }
  long long int ans = 0;
  for (int i = 0; i < n; ++i) {
    --hash[v[i]];
    long long int req = 1, x = v[i];
    unordered_map<int, int> pf;
    while (x != 1) {
      pf[spf[x]]++;
      x = x / spf[x];
    }
    for (auto x : pf) {
      int p = x.second;
      p = (k - x.second) % k;
      req = req * power(x.first, p);
    }
    ans = ans + hash[req];
  }
  cout << ans << '\n';
  return 0;
}
