#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef complex P; typedef pair pii; #define REP(i,n) for(ll i=0;i>Rshift; return (t>=N?t-N:t); } ll mdpw(ll a,ll b){ a = MR(a*R2); ll r = M1; while(b){ if(b&1)r=MR(r*a); a=MR(a*a); b>>=1; } return r; } void check(ll &ans, int p){ bool ex = false; REP(i,n){ st[i] = 0; ex |= a[i]%p==0; while(a[i]%p==0)a[i]/=p,st[i]++; } if(!ex)return; sort(st,st+n,greater()); int cnt = 0; REP(i,k)cnt += st[i]; ans=MR(ans*mdpw(p,cnt)); } int main(){ scanf("%d%d",&n,&k); REP(i,n)scanf("%d",&a[i]); // sieve vector sv(100000,true); sv[0]=false; sv[1]=false; ll ans = M1; FOR(p,2,100000){ if(!sv[p])continue; check(ans,p); int it = 2*p; while(it<100000)sv[it]=false,it+=p; } map M; REP(i,n)if(a[i]>1)M[a[i]]++; for(pii P: M){ int cnt = min(P.second,k); ans=MR(ans*mdpw(P.first,cnt)); } printf("%lld\n",MR(ans)); return 0; }