#include "bits/stdc++.h" using namespace std; #define rt return #define FOR(i,j,k) for(int i=j; i<(int)k;++i) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define mt make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; map factorize(ll n){ map res; for(ll i=2; i*i<=n; ++i){ while(n%i==0){ n /= i; ++res[i]; } } if(n!=1) ++res[n]; return res; } const int N_MAX = 1001, MOD = (int)1e9 + 7; map a[N_MAX], f[N_MAX]; int N, K, A[N_MAX]; int main(){ ios::sync_with_stdio(0); cin.tie(0); cin >> N >> K; rep(i, N)cin >> A[i], a[i] = factorize(A[i]); rep(i, N){ for(int j = min(K - 1, i); j >= 0; --j){ auto x = f[j]; each(p, a[i]) x[p.first] += p.second; each(p, f[j+1]) smax(p.second, x[p.first]); each(p, x){ smax(f[j + 1][p.first], p.second); } } } ll ans = 1; each(p, f[K]){ rep(i, p.second){ ans *= p.first; ans %= MOD; } } cout << ans << endl; }