#include "bits/stdc++.h" #include using namespace std; typedef long long ll; typedef pair pii; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define all(a) (a).begin(),(a).end() #define vi vector #define pb push_back #define INF 999999999 //#define INF (1LL<<59) ll power(ll a,ll b/*,ll mod*/){ ll ret=1; if(b>0){ ret = power(a,b/2/*,mod*/); if(b%2==0)ret = (ret*ret)/*%mod*/; else ret = (((ret*ret)/*%mod*/)*a)/*%mod*/; } return ret; } map prime_factorization(int n){ map ret; for(int div=2;div<=1+sqrt(n);div++){ while(n%div==0){ ret[div]++; n/=div; } } if(n!=1)ret[n]++; return ret; } int main(){ map> mp; int n,k; cin>>n>>k; rep(i,n){ int a; cin>>a; map res = prime_factorization(a); for(auto &p : res){ mp[p.first].pb(p.second); } } ll ans = 1; for(auto &elm : mp){ sort(all(elm.second),greater()); rep(i,min(k,elm.second.size())){ ans = (ans*power(elm.first,elm.second[i]))%1000000007; } } cout<