#include <bits/stdc++.h>
using namespace std;
using Pi = pair<int, int>;
using ll = long long;
string to_string(string s) { return s; }
template <class T>
string to_string(vector<T> v);
template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + "," + to_string(p.second) + "}";
}
template <class S>
string to_string(unordered_set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}
template <class S, class T>
string to_string(map<S, T> m) {
  string ret = "{";
  for (pair<S, T> x : m) ret += to_string(x) + ",";
  return ret + "}";
}
template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < (int)v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}
void debug() { cerr << endl; }
template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}
void print() { cout << endl; }
template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}
int n, k;
vector<Pi> dec(int n) {
  map<int, int> ret;
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  vector<Pi> ret2;
  for (Pi p : ret) {
    if (p.second % k > 0) ret2.push_back(Pi(p.first, p.second % k));
  }
  sort((ret2).begin(), (ret2).end());
  return ret2;
}
int main() {
  cin.tie(0);
  cin >> n >> k;
  map<vector<Pi>, int> mp;
  vector<int> a(n);
  for (int i = 0; i < (int)n; i++) {
    cin >> a[i];
    mp[dec(a[i])]++;
  }
  ll ans = 0;
  set<vector<Pi>> s;
  for (pair<vector<Pi>, int> p : mp) {
    if (s.count(p.first)) continue;
    bool f = 0;
    for (int i = 0; i < (int)p.first.size(); ++i) {
      if (p.first[i].second * 2 != k) f = 1;
      p.first[i].second = k - p.first[i].second;
    }
    if (f)
      ans += p.second * (ll)mp[p.first];
    else
      ans += p.second * (ll)(p.second - 1) / 2;
    s.insert(p.first);
  }
  cout << ans << endl;
  return 0;
}
