#include <bits/stdc++.h>
using namespace std;
const int N = 1000001;
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int min(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
long long int inf = 100000000000000000;
vector<int> adj[N];
int spf[100001];
void sieve() {
  spf[1] = 1;
  for (int i = 2; i < 100001; i++) spf[i] = i;
  for (int i = 4; i < 100001; i += 2) spf[i] = 2;
  for (int i = 3; i * i < 100001; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < 100001; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<int> getFactorization(int x) {
  vector<int> ret;
  while (x != 1) {
    ret.push_back(spf[x]);
    x = x / spf[x];
  }
  return ret;
}
void solve() {
  map<vector<pair<int, int> >, int> m;
  long long int ans = 0;
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 0; i < n; i++) {
    vector<int> p = getFactorization(a[i]);
    vector<pair<int, int> > list, need;
    int cnt = 1;
    for (int i = 1; i < p.size(); i++) {
      if (p[i] == p[i - 1]) {
        cnt++;
      } else {
        if (cnt % k != 0) list.push_back(make_pair(p[i - 1], cnt % k));
        cnt = 1;
      }
    }
    if (cnt % k != 0 && p.size()) list.push_back(make_pair(p.back(), cnt % k));
    sort((list).begin(), (list).end());
    for (long long int i = 0; i < list.size(); i++) {
      need.push_back(make_pair(list[i].first, k - list[i].second));
    }
    ans += m[need];
    m[list]++;
  }
  cout << ans << '\n';
}
int main() {
  sieve();
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  int t = 0;
  while (t++ < T) {
    solve();
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}
