import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); ArrayList prime = new ArrayList(); int[] a = new int[n]; for(int i = 0; i < n; i++) { a[i] = sc.nextInt(); int t = a[i]; for(int j = 2; j <= a[i]; j++) { if(t % j == 0) { if(!prime.contains(j)) prime.add(j); } while(t % j == 0) { t /= j; } } } int t = prime.size(); int[][] rui = new int[n][t]; for(int i = 0; i < n; i++) { int s = a[i]; for(int j = 0; j < t; j++) { int p = prime.get(j); while(s % p == 0) { s /= p; rui[i][j]++; } } } long ans = 1; long MOD = (long)Math.pow(10, 9) + 7; for(int j = 0; j < t; j++) { int[] r = new int[n]; for(int i = 0; i < n; i++) { r[i] = rui[i][j]; } Arrays.sort(r); int p = prime.get(j); for(int l = n - 1; l >= n - k; l--) { ans = (ans * (long)Math.pow(p, r[l])) % MOD; } } System.out.println(ans); } }