#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using vv = vector<vector<T>>;
template <class T>
inline bool MX(T &l, const T &r) {
  return l < r ? l = r, 1 : 0;
}
template <class T>
inline bool MN(T &l, const T &r) {
  return l > r ? l = r, 1 : 0;
}
const ll MOD = 1e9 + 7;
const int SQ = 344;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(0);
  int n, t;
  cin >> n >> t;
  vector<int> as(n);
  for (int(i) = 0; (i) < (n); ++(i)) cin >> as[i];
  unordered_map<ll, int> cnt;
  ll re = 0;
  for (int a : as) {
    ll tgt = 1;
    ll me = 1;
    for (int(i) = 2; (i) < (MOD); ++(i)) {
      if (1ll * i * i > a) break;
      int c = 0;
      for (; a % i == 0; a /= i) ++c;
      c %= t;
      if (c) {
        for (int(_) = 0; (_) < (t - c); ++(_))
          if (MN(tgt *= i, MOD)) break;
        ;
        for (int(_) = 0; (_) < (c); ++(_)) me *= i;
      }
    }
    if (a > 1) {
      for (int(_) = 0; (_) < (t - 1); ++(_))
        if (MN(tgt *= a, MOD)) break;
      me *= a;
    }
    re += cnt[me];
    ++cnt[tgt];
    ;
  }
  cout << re << endl;
  return 0;
}
