SIZE=1001; MOD=10**9+7 #998244353 #ここを変更する

SIZE += 1
inv = [0]*SIZE  # inv[j] = j^{-1} mod MOD
fac = [0]*SIZE  # fac[j] = j! mod MOD
finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE):
    inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD

def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

n,k = [int(i) for i in readline().split()]
a = [int(i) for i in readline().split()]

def product(p,q):
    res = [0]*(n+1)
    for i in range(n+1):
        for j in range(n-i+1):
            res[i+j] += p[i]*q[j]
            res[i+j] %= MOD
    return res
    

ans = [1]+[0]*n

for ai in a:
    q = [0]*(n+1)
    for j in range(n+1):
        q[j] = choose(n-j,n-ai)*finv[j]%MOD
    ans = product(ans,q)

res = ans[n]
for i in range(1,n+1):
    res *= i
    res %= MOD

print(res)









