#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const LL MOD = (LL)1e9 + 7;
const int MAXN = 1234;
LL fac[MAXN], invfac[MAXN];
LL dp[MAXN][MAXN];

LL add(LL a, LL b) {
    LL res = (a + b);
    if (res >= MOD) res -= MOD;
    return res;
}

LL sub(LL a, LL b) {
    return (a - b + MOD) % MOD;
}

LL mul(LL a, LL b) {
    return (a * b) % MOD;
}

LL qpow(LL n, LL p) {
    LL res = 1, base = n;
    while (p) {
        if (p & 1) res = mul(res, base);
        base = mul(base, base);
        p >>= 1;
    }
    return res;
}

void init() {
    fac[0] = invfac[0] = 1;
    for (int i = 1; i < MAXN; i++)
        fac[i] = mul(fac[i - 1], i);
    invfac[MAXN - 1] = qpow(fac[MAXN - 1], MOD - 2);
    for (int i = MAXN - 2; i >= 1; i--)
        invfac[i] = mul(invfac[i + 1], i + 1);
}

LL C(LL n, LL m) {
    if (m > n) return 0;
    LL res = mul(fac[n], invfac[m]);
    return mul(res, invfac[n - m]);
}

int main() {
    init();
    int N, K;
    scanf("%d %d", &N, &K);
    dp[0][0] = 1;
    for (int i = 1; i <= K; i++) {
        int a;
        scanf("%d", &a);
        for (int j = 0; j <= N; j++) {
            for (int k = 0; k <= min(j, a); k++) {
                LL coef = C(N - k, a - k);
                coef = mul(coef, invfac[k]);
                dp[i][j] = add(dp[i][j], mul(dp[i - 1][j - k], coef));
            }
            //printf("i = %d j = %d dp = %lld\n", i, j, dp[i][j]);
        }
    }
    printf("%lld\n", mul(dp[K][N], fac[N]));
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
by Benq;
*/
