#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int minprime[maxn];
map<vector<pair<int, int> >, int> cnt;
vector<pair<int, int> > sub;
vector<pair<int, int> > csub;
int n, k;
int a[maxn];
unsigned long long int ans;
void init() {
  for (int i = 2; i <= maxn; i++) {
    if (minprime[i]) continue;
    minprime[i] = i;
    for (int j = i; j <= maxn; j += i) {
      if (!minprime[j]) minprime[j] = i;
    }
  }
}
inline void divide(int a) {
  int pro;
  int t;
  while (a != 1) {
    t = minprime[a];
    pro = 0;
    while (a != 1 && !(a % t)) {
      a /= t;
      (pro += 1) %= k;
    }
    if (pro) {
      sub.push_back(pair<int, int>(t, pro));
      csub.push_back(pair<int, int>(t, k - pro));
    }
  }
}
int main() {
  init();
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    divide(a[i]);
    ans += cnt[csub];
    cnt[sub]++;
    sub.clear();
    csub.clear();
  }
  cout << ans;
  return 0;
}
