require 'prime' N, K = gets.split.map(&:to_i) A = gets.split.map(&:to_i) MOD = 10 ** 9 + 7 counter = Hash.new { |h, k| h[k] = [] } A.each do |a| if a.prime? counter[a] << 1 else a.prime_division.each do |e, cnt| counter[e] << cnt end end end ans = 1 counter.each do |e, nums| cnt = nums.sort.pop(K).sum ans *= e.pow(cnt, MOD) ans %= MOD end puts ans