#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const ll mod=(1e9)+7;
const int maxn=1010;
int n,k,a;
ll jc[maxn],iv[maxn],ivjc[maxn];
ll dp[25][maxn],ans;
ll C(ll x,ll y) {
	return jc[x]*ivjc[x-y]%mod*ivjc[y]%mod;
}
void update(ll &x,ll y) { x=(x+y)%mod; }
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(k);
	iv[0]=jc[0]=ivjc[0]=1;
	iv[1]=jc[1]=ivjc[1]=1;
	for (int i=2;i<=n;i++) {
		jc[i]=jc[i-1]*i%mod;
		iv[i]=(mod-mod/i)*iv[mod%i]%mod;
		ivjc[i]=ivjc[i-1]*iv[i]%mod;
	}
	dp[0][0]=1;
	for (int i=1;i<=k;i++) {
		read(a);
		for (int j=0;j<=n;j++) {
			for (int x=0;x<=a&&j+x<=n;x++) {
				update(dp[i][j+x],dp[i-1][j]*C(n-x,a-x)%mod*ivjc[x]%mod);
			}
		}
	}
	printf("%lld\n",dp[k][n]*jc[n]%mod);
	return 0;
}
/*
  REMEMBER:
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Array size? Integer overflow? Time complexity? Memory usage? Precision error?
*/