#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 20;
int n, k;
long long a[MAXN], b[MAXN];
map<long long, long long> cnt;
long long pow(long long base, long long exp) {
  long long ans = 1, mul = base;
  while (exp) {
    if (exp % 2) ans *= mul;
    mul *= mul;
    exp /= 2;
  }
  return ans;
}
long long strip(long long a) {
  long long ans = 1, orig = a;
  for (long long i = 2; i * i <= orig; i++) {
    if (a % i) continue;
    int cnt = 0;
    while (a % i == 0) {
      cnt++;
      a /= i;
    }
    ans *= pow(i, cnt % k);
  }
  if (a != 1) ans *= a;
  return ans;
}
long long complement(long long a) {
  long long ans = 1, orig = a;
  for (long long i = 2; i * i <= orig; i++) {
    if (a % i) continue;
    int cnt = 0;
    while (a % i == 0) {
      cnt++;
      a /= i;
    }
    ans *= pow(i, k - cnt % k);
  }
  if (a != 1) ans *= pow(a, k - 1);
  return ans;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) a[i] = strip(a[i]);
  for (int i = 1; i <= n; i++) b[i] = complement(a[i]);
  for (int i = 1; i <= n; i++) cnt[a[i]]++;
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    ans += (a[i] == b[i] ? cnt[a[i]] - 1 : cnt[b[i]]);
  printf("%lld\n", ans / 2);
}
