#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
mt19937 gen(34);
int n, k, a[100000], pr[100001];
long long kubi;
vector<pair<int, int>> razl[100000];
void resheto() {
  for (int i = 2; i <= 100000; i++)
    if (pr[i] == 0)
      for (int j = i; j <= 100000; j += i)
        if (pr[j] == 0) pr[j] = i;
}
long long kolvo(long long x) {
  map<pair<vector<int>, vector<int>>, long long> m;
  long long ans = 0;
  for (int i = 0; i < n; i++)
    if (razl[i].size() == x) {
      bool ch = true;
      vector<int> v1, v2, nv2;
      for (int j = 0; j < x; j++) {
        v1.push_back(razl[i][j].first);
        v2.push_back(razl[i][j].second);
        nv2.push_back(k - razl[i][j].second);
      }
      auto it = m.find(make_pair(v1, nv2));
      if (it != m.end()) ans += it->second;
      m[make_pair(v1, v2)]++;
    }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  resheto();
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    razl[i].push_back(make_pair(pr[a[i]], 0));
    int x = a[i];
    while (x != 1) {
      if (razl[i].back().first == pr[x])
        razl[i].back().second++;
      else
        razl[i].push_back(make_pair(pr[x], 1));
      x /= pr[x];
    }
    vector<int> pos;
    for (int j = 0; j < razl[i].size(); j++) {
      razl[i][j].second %= k;
      if (razl[i][j].second == 0) pos.push_back(j);
    }
    for (int j = 0; j < pos.size(); j++) {
      assert((razl[i].begin() + pos[j] - j)->second == 0);
      razl[i].erase(razl[i].begin() + pos[j] - j);
    }
    for (int j = 0; j < razl[i].size(); j++) assert(razl[i][j].second > 0);
  }
  long long ans = 0;
  for (int i = 1; i <= 15; i++) ans += kolvo(i);
  for (int i = 0; i < n; i++)
    if (razl[i].size() == 0) kubi++;
  cout << ans + (kubi - 1) * kubi / 2;
  return 0;
}
