#include <bits/stdc++.h>
#pragma GCC target("avx2,avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln = '\n';
template <class T1, class T2>
inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T1, class T2>
inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
inline int topbit(int x) { return x == 0 ? -1 : 31 - __builtin_clz(x); }
inline int topbit(long long x) { return x == 0 ? -1 : 63 - __builtin_clzll(x); }
inline int botbit(int x) { return x == 0 ? 32 : __builtin_ctz(x); }
inline int botbit(long long x) { return x == 0 ? 64 : __builtin_ctzll(x); }
inline int popcount(int x) { return __builtin_popcount(x); }
inline int popcount(long long x) { return __builtin_popcountll(x); }
inline int kthbit(long long x, int k) { return (x >> k) & 1; }
inline void print() { cout << "\n"; }
template <class T>
inline void print(const vector<T> &v) {
  for (auto itr = v.begin(); itr != v.end(); ++itr) cout << *itr << " ";
  print();
}
template <class T, class... Args>
inline void print(const T &x, const Args &...args) {
  cout << x << " ";
  print(args...);
}
inline void debug() {}
template <class T>
inline void debug(const vector<T> &v) {}
template <class T, class... Args>
inline void debug(const T &x, const Args &...args) {}
struct Fast_ios {
  Fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios;
const int MAX = 100000;
const ll INF = 1e6;
int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  vector<int> arr(MAX + 1, 1);
  for (int i = 2; i * i <= MAX; i++) {
    if (arr[i] != 1) continue;
    for (int j = 2; j * i <= MAX; j++) {
      if (arr[j * i] != 1) continue;
      arr[j * i] = i;
    }
  }
  auto prime = [&](int x) {
    vector<int> ret;
    while (arr[x] != 1) {
      ret.emplace_back(arr[x]);
      x /= arr[x];
    }
    ret.emplace_back(x);
    return ret;
  };
  vector<int> C(MAX);
  ll ans = 0;
  for (int i = 0; i < (N); ++i) {
    auto B = prime(A[i]);
    sort((B).begin(), (B).end());
    map<int, int> dic;
    for (auto j : B) {
      dic[j]++;
      if (dic[j] == K) dic.erase(j);
    }
    int val = 1;
    ll x = 1;
    for (auto j : dic) {
      for (int k = 0; k < (j.second); ++k) val *= j.first;
      for (int k = 0; k < (K - j.second); ++k) {
        x *= j.first;
        if (x > MAX) {
          chmin(x, INF);
          break;
        }
      }
    }
    if (x <= MAX) ans += C[x];
    C[val]++;
  }
  cout << ans << ln;
}
