using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Program { static void Main() { new Magatro().Solve(); } } struct P { public int Cost, Index; public P(int cost, int index) { Cost = cost; Index = index; } } class Magatro { private int N, K; private int[] A; private List Primes = new List(); private long ans = 1; private const int Mod = 1000000007; private void Scan() { var line = Console.ReadLine().Split(' '); N = int.Parse(line[0]); K = int.Parse(line[1]); A = new int[N]; line = Console.ReadLine().Split(' '); for (int i = 0; i < N; i++) { A[i] = int.Parse(line[i]); } } private void P() { int max = 100000; bool[] b = new bool[max + 1]; b[0] = true; b[1] = true; for (int i = 2; i * i <= max; i++) { if (!b[i]) { for (int j = i + i; j <= max; j += i) { b[j] = true; } } } for (int i = 0; i <= max; i++) { if (!b[i]) { Primes.Add(i); } } } private void Calc(int n) { int c = 0; int[] cnt = new int[N]; for (int i = 0; i < N; i++) { while (A[i] % n == 0) { A[i] /= n; cnt[i]++; } } Array.Sort(cnt, (a, b) => -a.CompareTo(b)); for (int i = 0; i < K; i++) { c += cnt[i]; } ans *= Pow(n, c); ans %= Mod; } private long Pow(long a, long b) { long res = 1; while (b > 0) { if (b % 2 == 1) { res *= a; res %= Mod; } b /= 2; a *= a; a %= Mod; } return res; } public void Solve() { Scan(); P(); foreach (int i in Primes) { Calc(i); } foreach (int i in A) { ans *= i; ans %= Mod; } Console.WriteLine(ans); } }