M=10**9+7
def c(n,k)
	r=1
	k.times{|i|
		r=r*(n-i)/(i+1)
	}
	r
end
a={}
n=gets.to_i-1
$<.map{|e|a[e.to_i]=1}
r=a.size
p r<1 ? 1 : c(n,r)*c(n,r-1)/n%M