require 'prime' def pow(x,y) z=1 y.times{z=z*x%M} z end M=10**9+7 E=Hash.new{|h,k|h[k]=[]} N,K=gets.split.map(&:to_i) IO.popen('factor '+gets){|io| io.each{|line| line.split[1..-1].map(&:to_i).group_by{|e|e}.each{|k,v|E[k]<