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