mod = 10**9+7
M = 1000

fact = [1]*(M+1)
factinv = [1]*(M+1)
inv = [1]*(M+1)
for n in range(2,M+1):
    fact[n] = n*fact[n-1]%mod
    inv[n] = -inv[mod%n]*(mod//n)%mod
    factinv[n] = inv[n]*factinv[n-1]%mod

def comb(n,k):
    return fact[n]*factinv[k]*factinv[n-k]%mod

N,K = map(int,input().split())
a = list(map(int,input().split()))

dp = [[0]*(N+1) for i in range(K+1)]
dp[0][0] = 1

for k in range(K):
    for n in range(1,N+1):
        for i in range(min(a[k]+1,n+1)):
            dp[k+1][n] += fact[a[k]]*factinv[a[k]-i]*fact[N-i]*factinv[N]*comb(n,i)*dp[k][n-i]
            dp[k+1][n] %= mod
ans = dp[-1][-1]
for i in range(K):
    ans *= comb(N,a[i])
    ans %= mod

print(ans)