#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> v;
map<int, int> glob;
long long onec = 0;
long long ans = 0;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> k;
  v.resize(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  map<int, int> mf;
  for (int ii = 0; ii < n; ii++) {
    if (v[ii] == 1) {
      ans += onec;
      onec++;
      continue;
    }
    mf.clear();
    int t = v[ii];
    int tq = sqrt(t);
    for (int i = 2; i <= tq; i++) {
      int fc = 0;
      while (t % i == 0) {
        fc++;
        t /= i;
      }
      if (fc && fc % k) mf[i] = fc % k;
    }
    if (t != 1) mf[t]++;
    long long res = 1;
    for (auto& p : mf) {
      if (p.second == 0) continue;
      int inv = k - p.second;
      for (int i = 0; i < inv; i++) {
        res *= 1LL * p.first;
        if (res > 1e12) {
          res = -1;
          goto NEXT;
        }
      }
    }
  NEXT:;
    if (res == 1)
      ans += onec;
    else if (res != -1)
      ans += (glob.find(res) != glob.end() ? glob[res] : 0);
    long long self = 1;
    for (auto& p : mf) {
      for (int i = 0; i < p.second; i++) self *= 1LL * p.first;
    }
    if (self == 1)
      onec++;
    else
      glob[self]++;
  }
  cout << ans << endl;
}
