#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const Int MOD = 1000000007;
const Int MAX = 10000;
Int fac[MAX], finv[MAX], inv[MAX];
int COMinit = ([](){
    fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}(), 0);
Int COM(int n, int k) {
    if (n < k || n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
Int dp[22][1010];
int main() {
    int N, K; cin >> N >> K;
    vector<int> A(K); for (auto &a : A) cin >> a;
    dp[0][0] = 1;
    for (int i = 0; i < K; i++) {
        for (int n = 0; n <= N; n++) {
            for (int m = 0; n + m <= N; m++) {
                dp[i + 1][n + m] += dp[i][n] * COM(N - n, m) % MOD * COM(N - m, A[i] - m);
                dp[i + 1][n + m] %= MOD;
            }
        }
    }
    cout << dp[K][N] << '\n';
    return 0;
}
