#include <bits/stdc++.h>
#define REP(i, x, y) for (ll i = x; i <= y; i++)
#define BIT(t) (1ll << t)
#define PER(i, y, x) for (ll i = y; i >= x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pll pair<ll, ll>
#define SIZE(v) ll(v.size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
//        ios::sync_with_stdio(false);
//        cin.tie(nullptr);

ll const MOD = 1e9 + 7;
ll mod_p(ll x, ll y) {
       x %= MOD;
       y %= MOD;
       return (x + y + MOD) % MOD;
}

ll mod_m(ll x, ll y) {
       x %= MOD;
       y %= MOD;
       return x * y%MOD;
}

ll mod_pow(ll x, ll t) {
       x %= MOD;
       if (t == 0) {
               return 1;
       }
       else {
               ll v = mod_pow(x, t / 2);
               if (t % 2 == 0) {
                       return v * v % MOD;
               }
               else {
                       return v * v%MOD * x %MOD;
               }
       }
}

ll mod_inv(ll x) {
       return mod_pow(x, MOD - 2);
}

vll fct(5000);
vll invfct(5000);

void init(){
        fct[0] = invfct[0] = 1;
        REP(i,1,2000){
                fct[i] = mod_m(fct[i-1], i);
                invfct[i] = mod_inv(fct[i]);
        }
}

ll ncr(ll x,ll y){
        return mod_m(fct[x], mod_m(invfct[y], invfct[x-y]));
}
int main(){
        init();
        ll n; ll k;
        cin >> n >> k;
        vll a(k+1);
        REP(i,1,k){
                cin >> a[i];
        }
        vvll dp(k+2, vll(n+2));
        dp[0][n] = 1;
        REP(y,1,k){
                REP(x,0,n){
                        REP(i,0,min(n-x, a[y])){
                                ll tmp = mod_m(ncr(x + i, i), mod_m(dp[y-1][x + i], ncr(n-i, a[y]-i)));
                                dp[y][x] = mod_p(dp[y][x], tmp);
                        }
                }
        }
        cout << dp[k][0] << endl;
}