#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;
ll inv[10000100];
ll FactorialInv[10000100];
ll Factorial[10000100];
ll beki(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = beki(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}
void init_combination(){
    const int MAX = 10000002;
    Factorial[0] = 1;
    inv[0] = 1;
    for(int i = 1; i <= MAX; i++){
        Factorial[i] = Factorial[i - 1] * i % mod;
    }
    FactorialInv[MAX] = beki(Factorial[MAX], mod - 2);
    for(ll i = MAX - 1; i >= 0; i--) {
        FactorialInv[i] = FactorialInv[i+1] * (i+1) % mod;
    }
    for(int i = 1; i <= MAX; i++) {
        inv[i] = FactorialInv[i] * Factorial[i-1] % mod;
    }
}
ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}

ll N, K;
vector<ll> a;
vector<vector<ll>> dp;
vector<ll> Inv;

int main() {
    init_combination();
    cin >> N >> K;
    a.resize(K);
    for(int i = 0; i < K; i++) cin >> a[i];
    Inv.resize(K);
    for(int i = 0; i < K; i++) {
        Inv[i] = beki(combination(N, a[i]), mod - 2);
    }
    dp.resize(K + 1);
    dp[0].resize(N + 1);
    dp[0][0] = 1;
    for(int i = 0; i < K; i++) {
        dp[i+1].resize(N + 1);
        for(ll before = 0; before <= N; before++) {
            for(ll delta = 0; delta <= a[i]; delta++) {
                if(before + delta > N) break;
                ll factor = dp[i][before] * combination(N - delta, a[i] - delta) % mod;
                factor *= Inv[i];
                factor %= mod;
                factor *= combination(N - before, delta);
                factor %= mod;
                dp[i+1][before+delta] += factor;
                dp[i+1][before+delta] %= mod;
            }
        }
    }
    /*
    for(int k = 0; k <= K; k++) {
        cerr << "------" << k << "-----" << endl;
        for(int i = 0; i <= N; i++) {
            cerr << dp[k][i] << " ";
        }
        cerr << endl;
    }
    */
    ll ans = dp[K][N];
    for(int i = 0; i < K; i++) {
        ans *= combination(N, a[i]);
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}
