#include <bits/stdc++.h>
using namespace std;
int N, k, a[100100];
map<int, int> h;
int simplify(int &x) {
  int y = x, newx = x, ret = 1;
  for (int i = 2; i * i <= x; ++i) {
    if (y % i == 0) {
      int cum = 1, cnt = 0;
      while (y % i == 0) {
        y /= i;
        cum *= i;
        ++cnt;
        if (cnt % k == 0) {
          newx /= cum;
          cum = 1;
          cnt = 0;
        }
      }
      if (cnt != 0) {
        for (int j = cnt + 1; j <= k; ++j) {
          ret *= i;
          if (ret > 100100) ret = 100100;
        }
      }
    }
  }
  if (y > 1) {
    for (int j = 2; j <= k; ++j) {
      ret *= y;
      if (ret > 100100) ret = 100100;
    }
  }
  x = newx;
  return ret;
}
int main() {
  cin >> N >> k;
  long long ret = 0;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    int x = simplify(a[i]);
    ret += h[x];
    h[a[i]]++;
  }
  cout << ret << "\n";
  return 0;
}
