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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

const ll N_MAX = 100005;

ll inv[N_MAX],fac[N_MAX],finv[N_MAX];
void make(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        fac[i]=fac[i-1]*(ll) i%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}

ll combination(ll C, ll D){
    if(C<D||C<0||D<0) return 0;
    return fac[C]*(finv[D]*finv[C-D]%mod)%mod;
}

ll dp[1010][25] = {};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    make();

    ll N, K;
    cin >> N >> K;
    vector<ll> a(K);
    REP(i, K) cin >> a[i];

    dp[0][0] = 1;
    REP(k, K){
      REP(n, N+1){
        ll res = 0;
        REP(i, N+1){
          ll tmp = (dp[i][k] * combination(N-(n-i), a[k]-(n-i)))%mod;
          tmp *= combination(n, i);
          tmp %= mod;
          res += tmp;
          res %= mod;
        }
        dp[n][k+1] = res;
      }
    }

    /*
    REP(i, N+1){
      REP(k, K+1){
        cout << dp[i][k] << " ";
      }
      cout << endl;
    }
    */

    cout << dp[N][K] << endl;
    return 0;
}