#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
long long a[MAXN], prime[MAXN], p[MAXN], cnt;
bool is_prime[MAXN];
void init_prime() {
  memset(is_prime, true, sizeof(is_prime));
  for (long long i = 2; i <= 100000; i++) {
    if (!is_prime[i]) continue;
    prime[++cnt] = i;
    for (long long j = i * i; j <= 100000; j += i) {
      is_prime[j] = false;
    }
  }
  is_prime[0] = false, is_prime[1] = false;
}
int main() {
  init_prime();
  memcpy(p, prime, sizeof(p));
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= cnt; i++) {
    for (int j = 1; j < k; j++) {
      prime[i] *= p[i];
      if (prime[i] > 1000000000000LL) {
        break;
      }
    }
  }
  map<long long, int> nums;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= cnt; j++) {
      if (prime[j] > a[i]) break;
      while (a[i] % prime[j] == 0) a[i] /= prime[j];
    }
    nums[a[i]]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    nums[a[i]]--;
    long long temp = 1, now = a[i];
    for (int j = 1; j <= cnt; j++) {
      if (p[j] > now) break;
      if (prime[j] > 1000000000000LL) break;
      if (now % p[j] == 0) temp *= prime[j];
      while (now % p[j] == 0) {
        now /= p[j];
        temp /= p[j];
      }
      if (temp > 100000) break;
    }
    if (temp <= 100000) {
      if (temp == 1 && a[i] == 1)
        ans += nums[temp];
      else if (temp != 1)
        ans += nums[temp];
    }
  }
  cout << ans << endl;
}
