#include <bits/stdc++.h>
#pragma G++ optimize "O2"
#pragma GCC optimize "O2"
#pragma G++ optimize "O3"
#pragma GCC optimize "O3"
#pragma G++ optimize "Ofast"
#pragma GCC optimize "Ofast"
using namespace std;
inline int read() {
  register char ch = getchar();
  register int ret = 0;
  while (!(ch >= '0' && ch <= '9')) ch = getchar();
  while (ch >= '0' && ch <= '9')
    ret = (ret << 3) + (ret << 1) + (ch ^ 48), ch = getchar();
  return ret;
}
int n, k;
const int maxn = 200010;
const int hashbase = 2333;
const int maxcnt = 60000;
int a[maxn];
int prime[maxn], cnt = 0;
int primeid[maxn];
bool vis[maxn];
unsigned long long hashfac[maxn];
void initPrime() {
  vis[1] = 1;
  for (register int i = 2; i < 100010; i++) {
    if (!vis[i]) {
      prime[++cnt] = i;
      primeid[i] = cnt;
    }
    for (register int j = 1; j <= cnt; j++) {
      if (prime[j] * i >= 100010) break;
      vis[prime[j] * i] = true;
      if (i % prime[j]) break;
    }
  }
}
void initHash() {
  hashfac[1] = hashbase;
  for (register int i = 2; i <= maxcnt; i++)
    hashfac[i] = hashfac[i - 1] * hashbase;
}
map<unsigned long long, int> mp;
long long ans = 0;
void solve(int x) {
  unsigned long long xhash = 0;
  unsigned long long aimhash = 0;
  int bakx = x;
  for (register int i = 1; i <= cnt; i++) {
    if (x == 1) break;
    if (prime[i] * prime[i] > x) break;
    if (x % prime[i] == 0) {
      int pcnt = 0;
      while (x % prime[i] == 0) {
        x /= prime[i];
        pcnt++;
        if (pcnt >= k) pcnt -= k;
      }
      xhash += hashfac[i] * pcnt;
      if (pcnt != 0) {
        aimhash += hashfac[i] * (k - pcnt);
      }
    }
  }
  if (x != 1) {
    xhash += hashfac[primeid[x]];
    aimhash += hashfac[primeid[x]] * (k - 1);
  }
  if (mp.count(aimhash)) {
    ans += mp[aimhash];
  }
  mp[xhash]++;
}
int main() {
  n = read(), k = read();
  for (register int i = 1; i <= n; i++) {
    a[i] = read();
  }
  initPrime();
  initHash();
  for (register int i = n; i >= 1; i--) {
    solve(a[i]);
    ;
  }
  printf("%lld\n", ans);
  return 0;
}
