#include <bits/stdc++.h>
using namespace std;
int Set(int mask, int pos) { return mask = mask | (1 << pos); }
bool check(int mask, int pos) { return (bool)(mask & (1 << pos)); }
const long long POSSIBLE_MAX = 10000000000;
const int MAX_VAL = 100000;
int arr[300005];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<vector<pair<long long, int> > > vp(n);
  map<vector<pair<long long, int> >, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    for (int j = 2; j * j <= arr[i]; j++) {
      if (arr[i] % j) continue;
      vp[i].push_back({j, 1});
      arr[i] /= j;
      while (arr[i] % j == 0) {
        vp[i].back().second++;
        arr[i] /= j;
      }
    }
    if (arr[i] != 1) vp[i].push_back({arr[i], 1});
  }
  for (int i = 0; i < n; i++) {
    vector<pair<long long, int> > temp;
    for (int j = 0; j < vp[i].size(); j++) {
      vp[i][j].second %= k;
      if (vp[i][j].second != 0) {
        temp.push_back(vp[i][j]);
      }
    }
    vp[i] = temp;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    mp[vp[i]]++;
  }
  for (int i = 0; i < n; i++) {
    vector<pair<long long, int> > temp;
    mp[vp[i]]--;
    for (int j = 0; j < vp[i].size(); j++) {
      temp.push_back(make_pair(vp[i][j].first, k - vp[i][j].second));
    }
    ans += mp[temp];
  }
  cout << ans << endl;
  return 0;
}
