#include<bits/stdc++.h>
#define ll long long
#define uint unsigned int
#define ull unsigned long long
#define inf 1010000000
#define infll 1010000000000000000ll
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define mpr make_pair
#define fi first
#define se second
#define pq priority_queue<int>
#define pqll priority_queue<ll>
#define up(x,y) (x<(y)?x=(y):0)
#define dn(x,y) (x>(y)?x=(y):0)
#define ad(x,y) (x=(x+(y))%mod)
#define cbn(x,y) ((ll)fac[x]*inv[y]%mod*inv[(x)-(y)]%mod)
#define mod 1000000007
#define N 1009
using namespace std;

int read(); ll readll();
int n,m,a[N],cbn[N][N],dp[N][N];
int main(){
	scanf("%d%d",&n,&m);
	int i,j,k;
	for (i=0; i<=n; i++)
		for (j=cbn[i][0]=1; j<=i; j++) cbn[i][j]=(cbn[i-1][j]+cbn[i-1][j-1])%mod;
	for (i=1; i<=m; i++) scanf("%d",&a[i]);
	dp[0][0]=1;
	for (i=1; i<=m; i++)
		for (j=0; j<=n; j++)
			for (k=0; k<=j; k++) if (a[i]>=j-k)
				ad(dp[i][j],(ll)dp[i-1][k]*cbn[n-k][j-k]%mod*cbn[n-(j-k)][a[i]-(j-k)]);
	printf("%d\n",dp[m][n]);
	return 0;
}


int read(){
	int x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}
ll readll(){
	ll x=0; char ch=getchar(); bool flag=0;
	while (ch<'0' || ch>'9'){ if (ch=='-') flag=1; ch=getchar(); }
	while (ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
	return flag?-x:x;
}