#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int P = 1e9 + 7;
int dp[44][2010];
int a[44], C[2010][2010];

int main() {
    int N, K;
    cin >> N >> K;
    for (int i = 1; i <= K; ++i) cin >> a[i];
    C[0][0] = 1;
    for (int i = 1; i <= max(N, K); ++i) {
        C[i][0] = 1;
        for (int j = 1; j <= i; ++j) {
            C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % P;
        }
    }
    dp[0][0] = 1;
    for (int i = 0; i < K; ++i) {
        for (int j = 0; j <= N; ++j) {
            for (int k = 0; k <= min(a[i + 1], N) ; ++k) {
                dp[i + 1][j + k] = (dp[i + 1][j + k] + (ll) dp[i][j] * C[N - j][k] % P * C[N - k][a[i + 1] - k] % P) % P;
            }
        }
    }
    cout << dp[K][N] << '\n';
    return 0;
}