#ifndef _MY   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( sse,sse2,sse3,ssse3,abm,mmx,tune=native )   #endif   #include  bits/stdc++.h    #define int ll   #define all(x) (x).begin(), (x).end()   using namespace std;   typedef long long ll;   typedef long double ld;   const int64_t INF = (int64_t)(2e18);   const int inf = (int)(1e9 + 7);   const int maxn = 500 * 1000 + 100;   chrono::time_point<chrono::steady_clock> cl;   double current_time() { return (double)(chrono::steady_clock::now() - cl).count() / 1e9; }   //------------------------------------------//               int32_t main(){       cl = chrono::steady_clock::now();       ios_base::sync_with_stdio(false);       cout << fixed << setprecision(10);       cin.tie(nullptr);   #ifdef _MY       freopen( VimProject/input.txt ,  r , stdin);       freopen( VimProject/output.txt ,  w , stdout);   #endif          int n, k;       cin >> n >> k;       if (k == 1) {           cout << 0;           return 0;       }       vector<int> a(n);       vector<int> sieve(1300000, 1);       sieve[0] = sieve[1] = 0;       vector<int> primes;       map<int, vector<int>> ma;       vector<pair<int, vector<int>>> gen;       for (int i = 2; i < (int)sieve.size(); ++i){           if (sieve[i] == 0) continue;           primes.push_back(i);           for (int j = 2*i; j < (int)sieve.size(); j += i)               sieve[j] = 0;       }          auto isprime = [&](int aa)->bool{           if (aa > ll(100000)*ll(100000)) return false;           if (aa == 1) return false;           for (int i = 2; i * i <= aa; ++i){               if (aa % i == 0) return false;           }           return true;       };       for (auto& it : a) cin >> it;       for (auto& it : a){           int cur = it;           int rt = (int)sqrt((double)cur+0.1);           if (rt*rt == cur && isprime(rt))                ma[rt].push_back(cur);           else{               //cout << cur << endl;               map<int, int> dec;               for (auto& p : primes){                   if (p*p > cur) break;                   while(cur % p == 0) {                       dec[p]++;                       cur /= p;                   }               }               if (isprime(cur)) {                   dec[cur]++;                   cur = 1;               }               //for (auto& it : dec) cout << it.first <<     << it.second << endl;               if (cur != 1) continue;               if (dec.size() == 0) continue;               if (dec.size() == 1) ma[dec.begin()->first].push_back(it);               if (dec.size() >= 2) {                   gen.push_back(make_pair(it, vector<int>()));                   for (auto& itt : dec) gen.back().second.push_back(itt.first);               }           }       }       //for (auto& it : ma) {       //    cout << it.first <<  :  ;       //    for (auto& itt : it.second) cout << itt <<    ;       //    cout << endl;       //}       vector<int> bad;       for (auto& it : ma){           sort(all(it.second));           if (it.second.size() == 1)                bad.push_back(it.first);       }       for (auto& it : bad) ma.erase(it);          vector<int> res;       int cnt = 0;       for (auto& it : ma) cnt += (int)it.second.size();       if (cnt <= k){           for (auto& it : ma){               for (auto& itt : it.second)                   res.push_back(itt);           }           for (auto& it : gen){               if ((int)res.size() == k) break;               bool good = true;               for (auto& itt : it.second)                   if (ma.count(itt) == 0) good = false;               if (good) res.push_back(it.first);           }           if ((int)res.size() != k) cout << 0;           else for (auto& it : res) cout << it <<    ;           return 0;       } else{           for (auto& it : ma) reverse(all(it.second));           if (k % 2 == 0){               for (auto& it : ma) {                   if ((int)res.size() == k) break;                   for (int i = 0; i < 2; ++i){                       res.push_back(it.second.back());                       it.second.pop_back();                   }               }               for (auto& it : ma){                   for (auto& itt : it.second){                       if ((int)res.size() == k) break;                       res.push_back(itt);                       it.second.pop_back();                   }               }               for (auto& it: res) cout << it <<    ;               return 0;           } else {               int ok = -1;               for (auto& it : ma){                   if (ok != -1) break;                   if (it.second.size() > 2) ok = it.first;               }               if (ok != -1){                   for (int i = 0; i < 3; ++i){                       res.push_back(ma[ok].back());                       ma[ok].pop_back();                   }                   for (auto& it : ma){                       if (it.first == ok) continue;                       if ((int)res.size() == k) break;                       for (int i = 0; i < 2; ++i){                           res.push_back(it.second.back());                           it.second.pop_back();                       }                   }                   for (auto& it : ma){                       for (auto& itt : it.second){                           if ((int)res.size() == k) break;                           res.push_back(itt);                       }                   }                   for (auto& it : res) cout << it <<    ;               } else{                   pair<int, vector<int>> fine(-1, vector<int>());                   for (auto& it : gen){                       bool good = true;                       for (auto& itt : it.second)                           if (ma.count(itt) == 0) good = false;                       if (!good) continue;                       if (fine.first == -1 || fine.second.size() > it.second.size())                           fine = it;                   }                   if (fine.first == -1) {                       cout << 0;                       return 0;                   }                   res.push_back(fine.first);                   set<int> used;                   for (auto& it : fine.second){                       used.insert(it);                       for (int i = 0; i < 2; ++i){                           res.push_back(ma[it].back());                           ma[it].pop_back();                       }                   }                   if ((int)res.size() > k){                       cout << 0;                       return 0;                   }                   for (auto& it : ma){                       if (used.count(it.first)) continue;                       if ((int)res.size() == k) break;                       for (int i = 0; i < 2; ++i){                           res.push_back(it.second.back());                           it.second.pop_back();                       }                   }                   for (auto& it : ma){                       for (auto& itt : it.second){                           if ((int)res.size() == k) break;                           res.push_back(itt);                       }                   }                   for (auto& it : res) cout << it <<    ;               }           }          }             return 0;   }