#include <bits/stdc++.h>
using namespace std;
const int N = 1e5, m1 = 1e9 + 7, m2 = 1e9 + 9;
int a[N + 11], n, k;
long long ans;
int u;
long long v;
void gao(int o) {
  u = v = 1;
  int x, y;
  for (int i = 2; i * i <= o; ++i) {
    if (o % i == 0) {
      y = 0;
      while (o % i == 0) ++y, o /= i;
      y %= k;
      if (!y) continue;
      for (int j = (1), j_end = (y); j <= j_end; ++j) u *= i;
      for (int j = (1), j_end = (k - y); j <= j_end; ++j) {
        v *= i;
        if (v > N) return;
      }
    }
  }
  u *= o;
  for (int j = (1), j_end = (k - 1); j <= j_end; ++j) {
    v *= o;
    if (v > N) return;
  }
}
int main() {
  cin >> n >> k;
  int x, y;
  for (int i = (1), i_end = (n); i <= i_end; ++i) {
    cin >> x;
    gao(x);
    if (v <= N) ans += a[v];
    ++a[u];
  }
  cout << ans << endl;
}
