#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

ll comb(ll fac[], ll ifac[], int n, int k, ll m){
    ll c = fac[n];
    c *= ifac[n-k], c %= m;
    c *= ifac[k], c %= m;
    return c;
}

int main(){
    int N, K;
    cin >> N >> K;
    int a[K];
    rep(i, K) cin >> a[i];
    ll n = N, m = MOD, inv[n+1];
    rep2(i, 1, n){
        inv[i] = 1;
        ll e[31];
        e[0] = i;
        rep2(j, 1, 30) e[j] = (e[j-1]*e[j-1]) % m;
        ll k = m-2;
        int cnt = 0;
        while(k > 0){
            if(k % 2 == 1) inv[i] *= e[cnt], inv[i] %= m;
            k /= 2;
            cnt++;
        }
    }
    ll fac[n+1], ifac[n+1];
    fac[0] = 1, ifac[0] = 1;
    rep2(i, 1, n){
        fac[i] = (fac[i-1]*i)%MOD;
        ifac[i] = (ifac[i-1]*inv[i])%MOD;
    }
    ll dp[K][N+1];
    rep(i, a[0]+1){
        dp[0][i] = fac[N];
        dp[0][i] *= comb(fac, ifac, N-i, a[0]-i, m);
        dp[0][i] %= m;
        dp[0][i] *= ifac[i], dp[0][i] %= m;
    }
    rep2(i, a[0]+1, N) dp[0][i] = 0;
    rep2(i, 1, K-1) rep(j, N+1){
        dp[i][j] = 0;
        int s = max(0, j-a[i]);
        rep2(k, s, j){
            ll x = j-k;
            ll tmp = dp[i-1][k];
            tmp *= comb(fac, ifac, N-x, a[i]-x, m);
            tmp %= m;
            tmp *= ifac[x], tmp %= m;
            dp[i][j] += tmp, dp[i][j] %= m;
        }
    }
    cout << dp[K-1][N] << endl;
}