#include <bits/stdc++.h>
int n, k;
int cnt[100005];
long long ans;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1, A; i <= n; i++) {
    scanf("%d", &A);
    int tmpA = 1;
    long long tmp = 1;
    for (int j = 2; j * j <= A; j++) {
      int cnt = 0;
      while (!(A % j)) A /= j, cnt++;
      for (int l = 0; l < cnt % k; l++) tmpA *= j;
      cnt = (k - cnt % k) % k;
      for (int k = 0; k < cnt; k++) {
        tmp *= j;
        if (tmp > 100000) break;
      }
      if (tmp > 100000) break;
    }
    if (tmp > 100000) continue;
    if (A > 1) {
      for (int j = 0; j < k - 1; j++) {
        tmp *= A;
        if (tmp > 100000) break;
      }
      tmpA *= A;
    }
    if (tmp > 100000) continue;
    ans += cnt[tmpA];
    cnt[tmp]++;
  }
  printf("%lld\n", ans);
}
