using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.IO; class Iroha { public Iroha() { } public static int Main() { new Iroha().calc(); return 0; } Scanner cin; Dictionary> dic; void GetDivisor(int a) { for (int i = 2; i * i <= a; i++) { if (a % i == 0) { int count = 0; while (a % i == 0) { count++; a /= i; } add(i, count); } } if (a != 0) { add(a, 1); } } void add(int a, int b) { if (!dic.ContainsKey(a)) dic[a] = new List(); dic[a].Add(b); } void calc() { cin = new Scanner(); int N = cin.nextInt(); int K = cin.nextInt(); dic = new Dictionary>(); for (int i = 0; i < N; i++) { GetDivisor(cin.nextInt()); } long ans = 1; long mod = 1000000007; foreach (var item in dic) { int a = item.Key; var b = item.Value; b.Sort(); b.Reverse(); for (int i = 0; i < Math.Min(b.Count, K); i++) { for (int j = 0; j < b[i]; j++) { ans *= a; ans %= mod; } } } Console.WriteLine(ans); } } class Scanner { string[] s; int i; char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string next() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } }