#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

#define MAX_N 200020
ll inv[MAX_N+10],fac[MAX_N+10],ifac[MAX_N+10];

void setComb(){
  inv[0]=1;inv[1]=1;fac[1]=1;ifac[1]=1;fac[0]=1;ifac[0]=1;
  for(int i=2;i<MAX_N;i++){
    inv[i]=(-MOD/i)*inv[MOD%i]%MOD;
    fac[i]=fac[i-1]*i%MOD;
    ifac[i]=ifac[i-1]*inv[i]%MOD;

    inv[i]=(inv[i]+MOD)%MOD;
    fac[i]=(fac[i]+MOD)%MOD;
    ifac[i]=(ifac[i]+MOD)%MOD;
  }
  return;
}

ll comb(ll n,ll k){
  if(n<k||n<0||k<0) return 0;
  else return ((fac[n]*ifac[k]%MOD*ifac[n-k]%MOD+MOD)%MOD);
}

ll hcomb(ll n,ll r){
  if(n==0&&r==0) return 1;
  else if(n<0||r<0) return 0;
  else return comb(n+r-1,r-1);
}

ll dp[21][1010];

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> A(K);
  rep(i,K) cin>>A[i];

  setComb();

  dp[0][0]=1;
  for(int i=0;i<K;i++){
    for(int j=0;j<=N;j++){
      for(int k=0;k<=A[i]&&j+k<=N;k++){
        ll coef=comb(N-j,k)*comb(N-k,A[i]-k)%MOD;
        add(dp[i+1][j+k],dp[i][j]*coef%MOD);
      }
    }
  }

  cout<<dp[K][N]<<endl;

  return 0;
}
