z=->x,y{r=1;y.times{r=x*r%M};r} M=10**9+7 E=Hash.new{|h,k|h[k]=[]} N,K=gets.split.map &:to_i IO.popen('factor '+gets){|_| _.each{|l| l.split[1..-1].map(&:to_i).group_by(&:+@).each{|k,v|E[k]<