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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll mod_pow(ll a,ll n){
	ll res=1;
	while(n>0){
		if(n&1)res=res*a%mod;
		a=a*a%mod;
		n>>=1LL;
	}
	return res;
}

ll fac[100010],finv[100010];

ll comb(ll n,ll r){
	if(n<0||r<0||n<r)return 0;
	else return (fac[n]*finv[r]%mod)*finv[n-r]%mod;
}

ll dp[22][1001];

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

  fac[0]=1;
  rep(i,100000)fac[i+1]=fac[i]*(i+1)%mod;
  rep(i,100001)finv[i]=mod_pow(fac[i],mod-2);

  ll n,k;
  cin>>n>>k;
  vector<ll> a(k);
  rep(i,k)cin>>a[i];
  dp[0][0]=1;
  rep(i,k)rep(j,n+1){
  	if(dp[i][j]==0)continue;
  	rep(x,min(a[i]+1,n-j+1)){
  		ll add=dp[i][j]*comb(n-x,a[i]-x)%mod;
  		(add*=finv[x])%=mod;
  		(dp[i+1][j+x]+=add)%=mod;
  	}
  }

  cout<<dp[k][n]*fac[n]%mod<<endl;

  return 0;
}
