#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int n, k, sp[N], cnt[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 2; i < N; i++) {
    if (sp[i]) continue;
    for (int j = i; j < N; j += i) {
      if (!sp[j]) sp[j] = i;
    }
  }
  cin >> n >> k;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    int g = 1, h = 1;
    while (x != 1) {
      int cur = sp[x];
      int cn = 0;
      while (x % cur == 0) {
        cn++;
        x /= cur;
      }
      cn %= k;
      if (cn == 0) continue;
      for (int i = 0; i < k; i++) {
        if (i < cn)
          g *= cur;
        else {
          if (1LL * h * cur >= N)
            h = N;
          else
            h *= cur;
        }
      }
    }
    if (h < N) ans += cnt[h];
    cnt[g]++;
  }
  cout << ans << endl;
}
