#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
const int mod=1000000007;
inline int ad(int x){return x>=mod?x-mod:x;}
inline int dec(int x){return x<0?x+mod:x;}
inline int power(int a,int b)
{
	int ans=1;
	while(b)
	{
		if(b&1)ans=1LL*ans*a%mod;
		a=1LL*a*a%mod;
		b>>=1;
	}return ans;
}
int fac[1010],inv[1010];
inline int C(int n,int m){return 1LL*fac[n]*inv[m]%mod*inv[n-m]%mod;}
int f[25][1010];
int main()
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	fac[0]=1;
	for(int i=1;i<=1000;i++)fac[i]=1LL*fac[i-1]*i%mod;inv[1000]=power(fac[1000],mod-2);
	for(int i=1000;i>=1;i--)inv[i-1]=1LL*inv[i]*i%mod;
	int n=read(),m=read();
	f[0][0]=1;
	for(int i=1;i<=m;i++)
	{
		int uf=read();
		for(int j=0;j<=n;j++)
		{
			for(int k=0;k<=min(uf,n-j);k++)f[i][j+k]=ad(f[i][j+k]+1LL*f[i-1][j]*C(n-j,k)%mod*C(n-k,uf-k)%mod);
		}
	}
	pr2(f[m][n]);
	return 0;
}