#include <bits/stdc++.h>
using namespace std;
mt19937 gen(chrono::system_clock::now().time_since_epoch().count());
const int N = 2e5 + 7;
const long long M = 1e9 + 7;
const long long inf = M * M;
const int FFTM = 998244353;
int n, k;
long long x[N], res;
unordered_map<long long, int> c;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < n; i++) {
    long long need = 1;
    long long now = 1;
    long long mn = 1;
    long long y = x[i];
    for (int d = 2; d * d <= x[i]; d++) {
      if (x[i] % d) continue;
      int cnt = 0;
      while (x[i] % d == 0) {
        x[i] /= d;
        cnt++;
      }
      for (int j = cnt; j % k != 0; j--) {
        if (now > inf / (long double)d)
          now = inf + 1;
        else
          now *= d;
      }
      for (int j = cnt; j % k != 0; j++) {
        if (need > inf / (long double)d)
          need = inf;
        else
          need *= d;
      }
    }
    if (x[i] > 1) {
      int cnt = 1;
      for (int j = cnt; j % k != 0; j--) {
        if (now > inf / (long double)x[i])
          now = inf + 1;
        else
          now *= x[i];
      }
      for (int j = cnt; j % k != 0; j++) {
        if (need > inf / (long double)x[i])
          need = inf;
        else
          need *= x[i];
      }
    }
    res += c[need];
    c[now]++;
  }
  cout << res;
  return 0;
}
