#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) {
  a = ((a) < 0 ? -(a) : (a));
  b = ((b) < 0 ? -(b) : (b));
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
const long long inf = 2147383647;
const long long mod = 1000000007;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;
int taken[100000 + 8];
vector<int> prime;
vector<pair<int, int> > v, target;
map<vector<pair<int, int> >, int> am;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  am.clear();
  for (int i = 4; i <= 100000; i += 2) {
    taken[i] = 1;
  }
  for (int i = 3; i * i <= 100000; i += 2) {
    if (!taken[i]) {
      for (int j = i * i; j <= 100000; j += i + i) {
        taken[j] = 1;
      }
    }
  }
  prime.push_back(2);
  for (long long i = (3); i <= (100000); ++i) {
    if (!taken[i]) {
      prime.push_back(i);
    }
  }
  int n, k, x, cnt;
  long long ans = 0;
  cin >> n >> k;
  for (long long e = (1); e <= (n); ++e) {
    cin >> x;
    v.clear();
    for (int i = 0;; i++) {
      if ((prime[i] * prime[i]) > x) break;
      if (x % prime[i] == 0) {
        cnt = 0;
        while (x % prime[i] == 0) {
          x /= prime[i];
          cnt++;
        }
        cnt %= k;
        if (cnt) {
          v.push_back(make_pair(prime[i], cnt));
        }
      }
    }
    if (x > 1) {
      v.push_back(make_pair(x, 1));
    }
    target.clear();
    for (int i = 0; i < ((long long)(v).size()); i++) {
      target.push_back(make_pair(v[i].first, k - v[i].second));
    }
    if (am.find(target) != am.end()) {
      ans += am[target];
    }
    am[v]++;
  }
  cout << ans << "\n";
  return 0;
}
