import itertools
from functools import reduce
from operator import mul

N, K = map(int, input().split())
a = list(map(int, input().split()))
b = 10**9+7

lst = []
ans = 0
for i in range(K):
    lst.append(list(itertools.combinations(range(N), a[i])))
for i in list(itertools.product(*lst)):
    c = [0 for _ in range(N)]
    flat = []
    for j in range(K):
        flat += i[j]
    for j in flat:
        c[j] += 1
    ans += reduce(mul, c)
    ans %= b

print(ans)