from math import factorial
import random


def get_comb(n, r):
    combination = int(factorial(n) / factorial(r) / factorial(n - r))
    return combination


n, k = map(int, input().split())
a_list = list(map(int, input().split()))
children = [0 for _ in range(n)]
happiness = 1

for a in a_list:
    c = get_comb(n, a)
    random_num = random.sample([i for i in range(n)], a)
    for r in random_num:
        children[r] += 1
    happiness *= c

child_expected = 1
for c in children:
    child_expected *= c
print(happiness*child_expected % (10**9+7))
