#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const long long sze = 5010;
long long INF = 1e12;
map<long long, long long> prost;
long long k;
void kol(long long n) {
  long long d = 2;
  long long col = 0;
  while (d * d <= n) {
    while (n % d == 0) {
      col++;
      n /= d;
    }
    if (col % k != 0) {
      prost[d] = (col % k);
    }
    d++;
    col = 0;
  }
  if (n != 1) {
    prost[n]++;
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, res = 0;
  cin >> n >> k;
  map<vector<pair<long long, long long>>, long long> m;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    vector<pair<long long, long long>> vec;
    vector<pair<long long, long long>> ans;
    kol(a);
    for (auto to : prost) {
      vec.push_back(to);
      ans.push_back({to.first, k - to.second});
    }
    res += m[ans];
    m[vec]++;
    prost.clear();
  }
  cout << res;
  return 0;
}
