#include<bits/stdc++.h>

typedef long long LL;

const int N=1005;
const int M=25;
const int MOD=1000000007;

int n,m,a[M],jc[N],ny[N],f[M][N];

int C(int n,int m)
{
	return (LL)jc[n]*ny[m]%MOD*ny[n-m]%MOD;
}

int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++) scanf("%d",&a[i]);
	jc[0]=jc[1]=ny[0]=ny[1]=1;
	for (int i=2;i<=n;i++) jc[i]=(LL)jc[i-1]*i%MOD,ny[i]=(LL)(MOD-MOD/i)*ny[MOD%i]%MOD;
	for (int i=2;i<=n;i++) ny[i]=(LL)ny[i-1]*ny[i]%MOD;
	f[0][0]=1;
	for (int i=0;i<m;i++)
		for (int j=0;j<=n;j++)
		{
			if (!f[i][j]) continue;
			for (int k=0;k<=a[i+1]&&j+k<=n;k++)
				(f[i+1][j+k]+=(LL)f[i][j]*C(j+k,j)%MOD*C(n-k,a[i+1]-k)%MOD)%=MOD;
		}
	printf("%d\n",f[m][n]);
	return 0;
}