#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
const int mod=1e9+7;
int n,k,a[21],f[1001],fac[1001],inv[1001],g[1001];
#define inc(x,y) x+=y,x>=mod?x-=mod:0
inline int C(int x,int y) {
	if(x<y||x<0||y<0) return 0;
	return (ll)fac[x]*inv[y]%mod*inv[x-y]%mod;
}
inline int kuai(int p,int q,int mod) {int tot=1;for(;q;p=(ll)p*p%mod,q>>=1) if(q&1) tot=(ll)tot*p%mod;return tot;}
int main()
{
	read(n),read(k);
	for(res i=1;i<=k;++i) read(a[i]);
	fac[0]=1;
	for(res i=1;i<=n;++i) fac[i]=(ll)fac[i-1]*i%mod;
	inv[n]=kuai(fac[n],mod-2,mod);
	for(res i=n-1;~i;--i) inv[i]=(ll)inv[i+1]*(i+1)%mod;
	f[0]=1;
	for(res i=1;i<=k;++i) {
	  memset(g,0,sizeof(g));
	  for(res j=0;j<=a[i];++j)
	    for(res l=n;l>=j;--l) inc(g[l],(ll)f[l-j]*C(n-j,a[i]-j)%mod*inv[j]%mod);
	  memcpy(f,g,sizeof(g));
	}
	print((ll)f[n]*fac[n]%mod,'\n');
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 