#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; } int main(){ scanf("%d%d",&n,&k); REP(i,n)scanf("%d",&a[i]); set P; REP(i,n){ int x = a[i]; for(int j=2;j*j<=x;++j){ if(x%j!=0)continue; P.insert(j); while(x%j==0)x/=j; //, ps[i].push_back(j); } if(x>1)P.insert(x); } ll ans = 1; for(int p:P){ REP(i,n){ int x = a[i]; st[i] = 0; while(x%p==0)x/=p,st[i]++; } sort(st,st+n); reverse(st,st+n); int cnt = 0; REP(i,k)cnt += st[i]; // DEBUG(p); // DEBUG(cnt); ans = ans * mdpw(p,cnt) % MOD; } printf("%lld\n",ans); return 0; }