#include <bits/stdc++.h>
using namespace std;
void dbg_out() { cerr << "\b\b]\n"; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << H << ", ";
  dbg_out(T...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  for (int &i : A) cin >> i;
  map<vector<int>, int> cnts;
  long long ans = 0, ones = 0;
  for (int i : A) {
    if (i == 1) {
      ans += ones;
      ones++;
    } else {
      map<int, int> pf;
      int x = i;
      for (int j = 2; j * j <= x; ++j) {
        if (x % j == 0) {
          int c = 0;
          while (x % j == 0) {
            c++;
            x /= j;
          }
          if (c % k) pf[j] = c % k;
        }
      }
      if (x > 1) {
        pf[x]++;
      }
      vector<int> remain, original;
      bool ok = true;
      for (auto j : pf) {
        if (j.second > k) {
          ok = false;
          break;
        }
        int var = k - j.second;
        for (int l = 1; l <= j.second; ++l) original.push_back(j.first);
        for (int l = 1; l <= var; ++l) remain.push_back(j.first);
      }
      if (remain.empty()) {
        ans += ones;
        ones++;
      } else if (ok) {
        ans += cnts[remain];
        cnts[original]++;
      }
    }
  }
  cout << ans;
  return 0;
}
