#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  map<int, int> mp;
  long long ans = 0, mx = 1e6;
  for (int i = 0; i < n; i++) {
    int first;
    scanf("%d", &first);
    int second = 1;
    long long yy = 1;
    for (int j = 2; j * j <= first; j++)
      if (first % j == 0) {
        int cnt = 0;
        while (first % j == 0) cnt++, first /= j;
        cnt %= k;
        if (cnt) {
          for (int t = 0; t < cnt; t++) second *= j;
          for (int t = cnt; t < k; t++) yy = min(mx, yy * j);
        }
      }
    if (first > 1) {
      int cnt = 1, j = first;
      for (int t = 0; t < cnt; t++) second *= j;
      for (int t = cnt; t < k; t++) yy = min(mx, yy * j);
    }
    if (mp.count(yy)) ans += mp[yy];
    mp[second]++;
  }
  cout << ans << endl;
  return 0;
}
