#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, k;
long long int ans = 0;
vector<pair<int, int>> v;
map<int, int> m;
int xx, yy;
bool ok;
void solve() {
  cin >> n >> k;
  for (int i = 1, x; i <= n; i++) {
    cin >> x;
    v.clear();
    for (int j = 2; j * j <= x; j++) {
      if (x % j == 0) {
        int cnt = 0;
        while (x % j == 0) {
          cnt = (cnt + 1) % k;
          x /= j;
        }
        if (cnt) v.push_back({j, cnt});
      }
    }
    if (x > 1) v.push_back({x, 1});
    xx = 1;
    yy = 1;
    ok = 1;
    for (auto p : v) {
      int nd = k - p.second;
      for (int j = 1; j <= nd; j++) {
        xx *= p.first;
        if (xx >= N) {
          ok = 0;
          break;
        }
      }
      yy *= pow(p.first, p.second);
    }
    if (ok) ans += m[xx];
    m[yy]++;
  }
  cout << ans;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
