#include <bits/stdc++.h>
const int N = 100100;
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  long long res = 0;
  map<vector<pair<int, int> >, int> d;
  for (int i = 1; i <= n; i++) {
    vector<pair<int, int> > a, b;
    int x;
    cin >> x;
    for (int j = 2; j * j <= x; j++) {
      int cnt = 0;
      while (x % j == 0) {
        cnt += 1;
        x /= j;
      }
      cnt %= k;
      if (cnt == 0) {
        continue;
      }
      a.push_back({j, cnt});
      b.push_back({j, k - cnt});
    }
    if (x > 1) {
      a.push_back({x, 1});
      b.push_back({x, k - 1});
    }
    res += d[b];
    d[a] += 1;
  }
  cout << res << "\n";
}
