N,K = map(int,input().split())
A = list(map(int,input().split()))
s = sum(A)
if s < N:
    print(0)
    exit()

MOD = 10**9+7

MAXN = N+5
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def ncr(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

dp = [[0]*(N+1) for i in range(K+1)]
dp[0][0] = 1
for i,a in enumerate(A):
    for j in range(N+1):
        for k in range(j,N+1):
            if k-j > a: break
            dp[i+1][k] += dp[i][j] * ncr(N-j, k-j) * ncr(N-(k-j), a-(k-j))
            dp[i+1][k] %= MOD
print(dp[-1][-1])