#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
const long long INF = 1e10;
const int mod = 998244353;
const double pi = (double)acos(-1);
int n, m, d[N + 10];
long long ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    int tmp = x;
    vector<pair<int, int> > g;
    for (int j = 2; j * j <= x; j++)
      if (tmp % j == 0) {
        int ocr = 0;
        while (tmp % j == 0) ocr++, tmp /= j;
        ocr %= m;
        if (!ocr) continue;
        g.push_back(make_pair(j, ocr));
      }
    if (tmp != 1) g.push_back(make_pair(tmp, 1));
    int sz = (int)g.size(), f = 1;
    long long c = 1;
    for (int j = 0; j < sz && f; j++) {
      int cnt = m - g[j].second;
      while (cnt && f) {
        c *= g[j].first;
        cnt--;
        if (c > N) f = 0;
      }
    }
    if (f) ans += d[c];
    int y = 1;
    for (int j = 0; j < sz; j++) {
      int cnt = g[j].second;
      while (cnt) {
        y *= g[j].first;
        cnt--;
      }
    }
    d[y]++;
  }
  cout << ans;
  return 0;
}
