#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > b, c;
map<vector<pair<int, int> >, int> d;
;
int n, m, ask, a[100086];
long long ans;
int main() {
  scanf("%d %d", &n, &m);
  ans = 0ll;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    b.clear();
    c.clear();
    int qs = a[i];
    for (int j = 2; j * j <= qs; j++) {
      if (a[i] % j == 0) {
        int sum = 0;
        while (a[i] % j == 0) {
          a[i] /= j;
          sum++;
        }
        sum %= m;
        if (sum) {
          b.push_back(make_pair(j, sum));
          c.push_back(make_pair(j, m - sum));
        }
      }
    }
    if (a[i] > 1) {
      b.push_back(make_pair(a[i], 1));
      c.push_back(make_pair(a[i], m - 1));
    }
    ans = ans + 1ll * d[c];
    d[b]++;
  }
  cout << ans << endl;
  return 0;
}
