#include // #include using namespace std; using ll = long long; using ull = unsigned long long; #define rep(i,a,b) for (ll i=a; i=b; i--) #define fore(i,a) for(auto &i:a) #define pb push_back #define _GLIBCXX_DEBUG #define All(a) (a).begin(), (a).end() #define YN(a) ((a) ? "Yes" : "No") template inline bool chmin(T& a, const T& b) {bool c=a>b; if(a>b) a=b; return c;} template inline bool chmax(T& a, const T& b) {bool c=a inline T gcd(T a,T b) {return (b==0)?a:gcd(b,a%b);} template inline T lcm(T a, T b) {return (a*b)/gcd(a,b);} const int inf = INT_MAX / 2; const ll linf = 1LL << 61; using vi = vector; using vvi = vector>; using vvvi = vector>>; using vll = vector; using vvll = vector>; using vvvll = vector>>; template void OUT(const T& x) { cout << x; } // ----- pair ----- template void OUT(const pair& p) { cout << "("; OUT(p.first); cout << ", "; OUT(p.second); cout << ")"; } // ----- vector ----- template void OUT(const vector& v) { cout << "[ "; for (const auto& x : v) { OUT(x); cout << " "; } cout << "]"; } // ----- set ----- template void OUT(const set& s) { cout << "{ "; for (const auto& x : s) { OUT(x); cout << " "; } cout << "}"; } // ----- map ----- template void OUT(const map& mp) { cout << "{ "; for (const auto& [k,v] : mp) { OUT(k); cout << ": "; OUT(v); cout << ", "; } cout << "}"; } // ----- queue ----- template void OUT(queue q) { cout << "< "; while (!q.empty()) { OUT(q.front()); cout << " "; q.pop(); } cout << ">"; } // ----- priority_queue ----- template void OUT(priority_queue pq) { cout << "< "; while (!pq.empty()) { OUT(pq.top()); cout << " "; pq.pop(); } cout << ">"; } // ----- stack ----- template void OUT(stack st) { cout << "< "; while (!st.empty()) { OUT(st.top()); cout << " "; st.pop(); } cout << ">"; } // ----- deque ----- template void OUT(const deque& dq) { cout << "[ "; for (const auto& x : dq) { OUT(x); cout << " "; } cout << "]"; } #define out(x) cerr << #x << ": ", OUT(x), cerr << '\n'; ll pow(ll a, ll n){ ll ans = 1; rep(i,0,n){ ans *= a; } return ans; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll n,k; cin >> n >> k; vll divs((1e+6)+1,0); rep(i,0,n){ ll a; cin >> a; for(ll j = 2; j*j <= a; ++j){ if(a%j != 0) continue; ll ex = 0; while(a%j == 0){ ex ++; a /=j; divs[pow(j,ex)] ++; } } if(a != 1) divs[a] ++; } ll lim = n - ((n/k) - 1); ll ans = 1; // rep(i,0,10){ // cout << divs[i] << endl; // } rep(i,0,divs.size()){ if(divs[i] >= lim) ans *= i; } cout << ans << endl; cout << fixed << setprecision(30); return 0; }