# http://drken1215.hatenablog.com/entry/2020/01/12/011700

def main():
    MOD = 10 ** 9 + 7

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

    # -+-+-+-prepare combination-+-+-+-
    # -+-+-+-START-+-+-+-
    fact = [0] * (N + 1)
    fact[0] = 1
    fact[1] = 1
    for x in range(2, N + 1):
        fact[x] = x * fact[x - 1] % MOD

    invs = [1] * (N + 1)
    invs[N] = pow(fact[N], MOD - 2, MOD)
    for x in range(N - 1, 0, -1):
        invs[x] = invs[x + 1] * (x + 1) % MOD

    def cmb(n, r):
        if n - r < r: return cmb(n, n - r)
        if r < 0: return 0
        if r == 0: return 1
        if r == 1: return n
        return (((fact[n] * invs[r]) % MOD) * invs[n - r]) % MOD

    # -+-+-+-END-+-+-+-

    dp = [0] * (N + 1)
    dp[0] = 1

    for i, ai in enumerate(a):
        ndp = [0] * (N + 1)
        for counted in range(N + 1):
            for to_count in range(min(N - counted, ai) + 1):
                ndp[counted + to_count] = (
                                                  ndp[counted + to_count]
                                                  + dp[counted]
                                                  * cmb(N - counted, to_count)
                                                  * cmb(N - to_count, ai - to_count)
                                          ) % MOD
        dp = ndp

    print(dp[N])


if __name__ == '__main__':
    main()
