#include <bits/stdc++.h>
using namespace std;
const int inf = 1e5;
int a[100010];
int vaz[100010];
long long aux1;
void solve(int nr, long long prime) {
  if (aux1 > inf) return;
  for (int i = 1; i <= nr; i++) {
    aux1 *= prime;
    if (aux1 > inf) return;
  }
}
int main() {
  int n, k;
  long long sol = 0;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    int c = a[i], aux = 1;
    aux1 = 1;
    for (long long j = 2; j * j <= c; j++)
      if (c % j == 0) {
        int nr = 0;
        while (c % j == 0) {
          c /= j;
          nr++;
        }
        nr %= k;
        if (nr == 0) continue;
        for (int k1 = 1; k1 <= nr; k1++) aux *= j;
        solve(k - nr, j);
      }
    if (c > 1) {
      aux *= c;
      solve(k - 1, c);
    }
    if (aux1 <= inf) sol += vaz[aux1];
    vaz[aux]++;
  }
  printf("%lld", sol);
  return 0;
}
