#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
std::vector<long long int> pr;
void soe(long long int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (long long int p = 2; p * p <= n; p++)
    if (prime[p] == true)
      for (long long int i = p * p; i <= n; i += p) prime[i] = false;
  for (long long int p = 2; p <= n; p++)
    if (prime[p]) pr.push_back(p);
  ;
}
std::map<vector<pair<long long int, long long int> >, long long int> m;
std::vector<vector<pair<long long int, long long int> > > need;
void solve() {
  soe(1005);
  long long int n, k;
  cin >> n >> k;
  long long int a, ans = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a;
    vector<pair<long long int, long long int> > temp, cur_need;
    for (auto& b : pr) {
      long long int times = 0;
      if (a == 1 || a == 0) break;
      while (a % b == 0) {
        a /= b;
        times++;
      }
      if (times % k) temp.push_back(make_pair(b, times % k));
      ;
      if (b * b > a) break;
    }
    if (a > 1) temp.push_back(make_pair(a, 1));
    ;
    sort(temp.begin(), temp.end());
    for (auto& b : temp) {
      cur_need.push_back(make_pair(b.first, k - b.second));
      ;
    }
    sort(cur_need.begin(), cur_need.end());
    if ((long long int)(cur_need.size())) {
      need.push_back(cur_need);
      ;
    }
    if ((long long int)(temp.size())) {
      m[temp]++;
    } else {
      temp.push_back(make_pair(0, 0));
      ;
      m[temp]++;
    }
  }
  std::vector<pair<long long int, long long int> > t;
  t.push_back(make_pair(0, 0));
  ;
  ans += (m[t] * (m[t] - 1));
  for (auto& b : need) {
    if (k % 2 == 0) {
      long long int flag = 1;
      for (auto& c : b) {
        if (c.second != k / 2) flag = 0;
      }
      if (flag) {
        ans += m[b] - 1;
      } else {
        ans += m[b];
      }
      continue;
    }
    ans += m[b];
  }
  ans /= 2;
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
long long int power(long long int x, long long int y, long long int tt) {
  long long int res = 1;
  x = x % tt;
  while (y > 0) {
    if (y & 1) res = (res * x) % tt;
    y = y >> 1;
    x = (x * x) % tt;
  }
  return res;
}
