#include<bits/stdc++.h>
const int mo=1e9+7,N=1005;
int n,K,i,j,k,a,f[25][N],C[N][N];
int main(){
	for(i=**C=1;i<N;++i)for(j=*C[i]=1;j<=i;++j)C[i][j]=(C[i-1][j-1]+C[i-1][j])%mo;
	scanf("%d%d",&n,&K);f[0][n]=1;
	for(i=1;i<=K;++i){
		scanf("%d",&a);
		for(j=0;j<=a;++j)for(k=n;k>=j;--k)f[i][k-j]=(f[i][k-j]+1ll*f[i-1][k]*C[k][j]%mo*C[n-j][a-j])%mo;
	}
	printf("%d\n",f[K][0]);
	return 0;
}