#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFLL = 1e18;
const int MOD = 1e9 + 7;
const long double PI = atan(1.0) * 4L;
const int MAXINT = 2e5 + 10;
int minDiv[MAXINT];
void initMinDiv(int mxINT = MAXINT - 1) {
  for (int i = 0; i < mxINT + 1; i++) minDiv[i] = i;
  for (int i = 2; i < mxINT + 1; i++)
    if (minDiv[i] == i) {
      for (int j = 2 * i; j < mxINT + 1; j += i) minDiv[j] = min(minDiv[j], i);
    }
}
vector<pair<int, int> > factors(int n) {
  vector<pair<int, int> > ans;
  while (n > 1) {
    int p = minDiv[n], j = 0;
    while (n % p == 0) n /= p, j++;
    ans.push_back({p, j});
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k, a[MAXINT];
  cin >> n >> k;
  map<long long, int> cnt;
  initMinDiv();
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    long long need = 1, newAi = 1;
    for (pair<int, int> p : factors(a[i])) {
      if (p.second % k > 0) {
        int falta = k - p.second % k;
        long long num = 1;
        for (int i = 0; i < falta; i++)
          if (need <= 1e5) need *= p.first;
        for (int i = 0; i < p.second % k; i++) newAi *= p.first;
      }
    }
    if (need <= 1e5) ans += cnt[need];
    cnt[newAi]++;
  }
  cout << ans << endl;
  return 0;
}
