#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<20|1;
inline char gc(){
    static char ibuf[RLEN],*ib,*ob;
    (ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob)?EOF:*ib++;
}
inline int read(){
    char ch=gc();
    int res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
    return f?res:-res;
}
template<class tp>inline void chemx(tp &a,tp b){a<b?a=b:0;}
template<class tp>inline void chemn(tp &a,tp b){a>b?a=b:0;}
cs int mod=1e9+7;
inline int add(int a,int b){return (a+=b)>=mod?(a-mod):a;}
inline int dec(int a,int b){a-=b;return a+(a>>31&mod);}
inline int mul(int a,int b){static ll r;r=1ll*a*b;return (r>=mod)?(r%mod):r;}
inline void Add(int &a,int b){(a+=b)>=mod?(a-=mod):0;}
inline void Dec(int &a,int b){a-=b,a+=a>>31&mod;}
inline void Mul(int &a,int b){static ll r;r=1ll*a*b;a=(r>=mod)?(r%mod):r;}
inline int ksm(int a,int b,int res=1){for(;b;b>>=1,Mul(a,a))(b&1)&&(Mul(res,a),1);return res;}
inline int Inv(int x){return ksm(x,mod-2);}
inline int fix(int x){return (x<0)?x+mod:x;}
cs int N=1005,M=22;
int f[M][N],c[N][N];
int n,K,a[M];
int main(){
	#ifdef Memoria
	freopen("lx.in","r",stdin);
	#endif
	n=read(),K=read();
	for(int i=1;i<=K;i++)a[i]=read();
	for(int i=0;i<=n;i++){
		c[i][0]=c[i][i]=1;
		for(int j=1;j<i;j++)
		c[i][j]=add(c[i-1][j-1],c[i-1][j]);
	}
	f[0][0]=1;
	for(int i=1;i<=K;i++)
	for(int j=0;j<=n;j++)
	for(int k=0;k<=j;k++)if(a[i]>=j-k){
		Add(f[i][j],mul(f[i-1][k],mul(c[n-k][j-k],c[n-j+k][a[i]-j+k])));
	}
	cout<<f[K][n]<<'\n';
}
