#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k, a;
  cin >> n >> k;
  map<int, int> m, inv;
  while (n--) {
    cin >> a;
    if (a == 1) {
      m[a] += 1;
      inv[a] = 1;
      continue;
    }
    long long int x = 1, x_inv = 1;
    for (long long int i = 2; i * i <= a; i += 1) {
      if (a % i) {
        continue;
      }
      int pow_i = 0;
      while (a % i == 0) {
        a /= i;
        pow_i += 1;
      }
      pow_i %= k;
      if (pow_i) {
        for (int j = 0; j < pow_i; j++) {
          x *= i;
        }
        for (int j = pow_i; j < k; j++) {
          x_inv *= i;
          if (x_inv > 100000) {
            x_inv = 0;
            break;
          }
        }
      }
      if (!x_inv) {
        break;
      }
    }
    if (a > 1) {
      x *= a;
      for (int j = 1; j < k; j++) {
        x_inv *= a;
        if (x_inv > 100000) {
          x_inv = 0;
          break;
        }
      }
    }
    if (!x_inv) {
      continue;
    }
    m[x] += 1;
    inv[x] = x_inv;
  }
  long long int res = 0;
  for (auto& p : inv) {
    if (p.first > p.second) {
      continue;
    }
    if (p.first != p.second) {
      res += 1ll * m[p.first] * m[p.second];
    } else {
      res += 1ll * m[p.first] * (m[p.first] - 1) / 2;
    }
  }
  cout << res << "\n";
  return 0;
}
