#include <bits/stdc++.h>
using namespace std;
int x;
long long n, k;
long long r;
vector<pair<int, int> > a[2];
map<vector<pair<int, int> >, long long> z;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    for (int u = 2; u * u <= x; u++) {
      int c = 0;
      while (x % u == 0) {
        x /= u;
        c++;
      }
      c %= k;
      if (c % k == 0) continue;
      a[0].push_back({u, c});
      a[1].push_back({u, k - c});
    }
    if (x ^ 1) {
      a[0].push_back({x, 1});
      a[1].push_back({x, k - 1});
    }
    r += z[a[1]];
    z[a[0]]++;
    a[0].clear();
    a[1].clear();
  }
  cout << r << '\n';
  return 0;
}
