#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;
const ll Mod=1e9+7;


vector<ll> inv,fact,invfact;
void Mod_build(int n=101010){
	fact.resize(n+1);
	inv.resize(n+1);
	invfact.resize(n+1);
	fact[0]=inv[0]=invfact[0]=1;
	inv[1]=1;
	for(ll i=0;i<n;i++){
		fact[i+1]=fact[i]*(i+1)%Mod;
		if(i>0)inv[i+1]=Mod-inv[Mod%(i+1)]*(Mod/(i+1))%Mod;
		invfact[i+1]=invfact[i]*inv[i+1]%Mod;
	}
}
ll perm(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return fact[n]*invfact[n-k]%Mod;
}
ll comb(int n,int k){
	if(n<0||k<0||k>n)return 0;
	return (fact[n]*invfact[n-k]%Mod)*invfact[k]%Mod;
}
ll powMod(ll n,ll k){
	k%=Mod-1;
	if(k<0)k+=Mod-1;
	ll ret=1;
	while(k){
		if(k&1)ret=ret*n%Mod;
		n=n*n%Mod;
		k>>=1;
	}
	return ret;
}

int main(){
  int i,j,l;
  ll n,k;
  cin>>n>>k;
  ll a[k+1];
  for(i=1;i<=k;i++) cin>>a[i];
  Mod_build();
  VVI s(21,VI(1010,0));
  s[0][0]=1;

  for(i=1;i<=k;i++){
      for(j=0;j<=n;j++){
          ll u=comb(n,a[i]);
          s[i][j]=u*s[i-1][j]%mod;
          for(l=1;l<=j;l++){
              ll p=comb(n-l,a[i]-l)*comb(j,l)%mod;
              s[i][j]+=p*s[i-1][j-l];
              s[i][j]%=mod;
          }
      }
  }
  cout<<s[k][n]<<endl;
  for(i=0;i<5;i++){
     // cout<<i<<" "<<s[1][i]<<endl;
  } 
  return 0;
}
