n,k= map(int,input().split())
a = list(map(int, input().split()))
mod = 10**9+7
C = 1

def nCk(n,k):
	ans = 1
	for i in range(1,n+1):
		ans *= i
		ans %= mod

	for i in range(1,k+1):
		ans *= pow(i,mod-2,mod)
	for i in range(1,n-k+1):
		ans *= pow(i,mod-2,mod)

	return ans

for i in range(k):
	C *= a[i]
	C %= mod
	C *= pow(n,mod-2,mod)

for i in range(k):
	C *= nCk(n,a[i])
	C %= mod

print(C)