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

def combination_builder(max_value, mod):
    fact = [-1] * (max_value + 1)
    fact[0] = 1
    fact[1] = 1
    for x in range(2, max_value + 1):
        fact[x] = x * fact[x - 1] % mod

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

    def _combination(n, r):
        """combination(max_value, all)"""
        nonlocal fact, invs, mod

        if n - r < r: return _combination(n, n - r)
        if r < 0: return 0
        if r == 0: return 1
        if r == 1: return n
        return fact[n] * invs[r] * invs[n - r] % mod

    return _combination


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

    n, k = map(int, input().split())
    *a, = map(int, input().split())

    cmb = combination_builder(max_value=n, mod=MOD)

    dp = [[0] * (n + 1) for _ in range(k + 1)]
    dp[0][0] = 1

    for i, ai in enumerate(a):
        for counted in range(n + 1):
            for to_count in range(ai + 1):
                if counted + to_count > n:
                    break
                dp[i + 1][counted + to_count] = (
                                                        dp[i + 1][counted + to_count]
                                                        + dp[i][counted]
                                                        * cmb(n - counted, to_count)
                                                        * cmb(n - to_count, ai - to_count)
                                                ) % MOD

    print(dp[k][n])


if __name__ == '__main__':
    main()
