#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>=1; } return r; } void check(ll &ans, ll p){ REP(i,n){ st[i] = 0; while(a[i]%p==0)a[i]/=p,st[i]++; } sort(st,st+n,greater()); int cnt = 0; REP(i,k)cnt += st[i]; ans = ans * mdpw(p,cnt) % MOD; } int main(){ scanf("%d%d",&n,&k); REP(i,n)scanf("%d",&a[i]); ll ans = 1; int p = 2; REP(i,n){ for(;p*p<=a[i];++p){ if(a[i]%p!=0)continue; check(ans,p); } if(a[i]>100000)ans=ans*a[i]%MOD, a[i]=1; else if(a[i]>1)check(ans,a[i]); } printf("%lld\n",ans); return 0; }