#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int mod=1e9+7;
#define N 1010
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,m,a[22],inv[N],C[N][N],dp[N][N];
int main(){
	n=read(),m=read();
	C[0][0]=1;
	for(int i=1;i<=n;++i){
		C[i][0]=1;
		for(int j=1;j<=i;++j){
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
		}
	}
	for(int i=1;i<=m;++i){
		a[i]=read();
	}
	dp[0][0]=1;
	for(int i=1;i<=m;++i){
		for(int j=0;j<=n;++j){
			for(int k=0;k<=min(j,a[i]);++k){
				dp[i][j]=(dp[i][j]+1LL*dp[i-1][j-k]*C[j][k]%mod*C[n-k][a[i]-k])%mod;
			}
		}
	}
	printf("%d\n",dp[m][n]);
	return 0;
}

