#include<bits/stdc++.h>

using namespace std;

template<int mod,int pr> class NTT{
public:
	long long mod_pow(long long a,long long b){
		long long res=1;
		while(b){
			if(b&1) res=res*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return res;
	}
	void ntt(vector<int> &a,bool flag){
		int n=a.size();
			vector<int> &x=a,y(n);
		if(n==1) return;
		
		long long s=flag?(mod-1)/n:(mod-1-(mod-1)/n), z=mod_pow(pr,s);
		
		vector<int> zt(n/2+1,1);
		for(int i=1;i<=n/2;i++) zt[i]=zt[i-1]*z%mod;
		for(int k=1,h=n/2;k<n;k<<=1,h>>=1){
			int ki=0;
			for(int i=0;i<h;i++){
				long long coef=zt[k*i];
				for(int j=0;j<k;j++){
					int t0=x[j+ki],t1=x[j+ki+n/2];
					y[j+2*ki]=(t0+t1)%mod;
					y[j+2*ki+k]=(t0-t1+mod)*coef%mod;
				}
				ki+=k;
			}
			x.swap(y);
		}
		if(!flag){
			long long in=mod_pow(n,mod-2);
			for(int i=0;i<n;i++) x[i]=x[i]*in%mod;
		}
	}
	vector<int> convolution(vector<int> a,vector<int> b){
		int n=a.size()+b.size()-1;
		if(n<=40){
			vector<int> res(n);
			for(int i=0;i<a.size();i++){
				for(int j=0;j<b.size();j++){
					res[i+j]+=1LL*a[i]*b[j]%mod;
					if(res[i+j]>=mod) res[i+j]-=mod;
				}
			}
			return res;
		}
		int m=1;
		while(m<n) m*=2;
		a.resize(m);
		b.resize(m);
		ntt(a,true),ntt(b,true);
		for(int i=0;i<a.size();i++) a[i]=1LL*a[i]*b[i]%mod;
		ntt(a,false);
		a.resize(n);
		return a;
	}
};
long long inv(long long a,long long mod){
	long long b=mod,p=1,q=0;
	while(b){
		long long c=a/b,d=a;
		a=b;
		b=d%b;
		d=p;
		p=q;
		q=d-c*q;
	}
	return (p+mod)%mod;
}
vector<int> mod_equations(vector<int> &a,vector<int> &p){
	//find smallest x such that x=a_i mod p_i.
	//If x=k_0+k_1 p_0+k_2 p_0 p_1+...+k_(n-1) p_0p_1...p_(n-2), return (k_0,k_1,...,k_(n-1)).
	int n=a.size();
	vector<int> res(n);
	res[0]=a[0]%p[0];
	for(int i=1;i<n;i++){
		long long coef=1;
		long long s=0;
		for(int j=0;j<i;j++){
			s=(s+res[j]*coef%p[i])%p[i];
			coef=coef*p[j]%p[i];
		}
		s=(p[i]-s+a[i])%p[i];
		coef=inv(coef,p[i]);
		res[i]=(int)(coef*s%p[i]);
	}
	return res;
}
vector<long long> convolution(vector<int> &a,vector<int> &b){
	NTT<167772161,3> nt1;
	NTT<469762049,3> nt4;
	NTT<998244353,3> nt9;
	vector<int> p={167772161,469762049,998244353};
	vector<int> res1=nt1.convolution(a,b);
	vector<int> res4=nt4.convolution(a,b);
	vector<int> res9=nt9.convolution(a,b);
	vector<long long> res(res1.size());
	for(int i=0;i<res1.size();i++){
		vector<int> eq={res1[i],res4[i],res9[i]};
		vector<int> coef=mod_equations(eq,p);
		res[i]=coef[0]+1LL*coef[1]*p[0]+1LL*coef[2]*p[0]*p[1];//overflow
	}
	return res;
}
vector<int> convolution(vector<int> &a,vector<int> &b,int mod){
	NTT<167772161,3> nt1;
	NTT<469762049,3> nt4;
	NTT<998244353,3> nt9;
	vector<int> p={167772161,469762049,998244353};
	vector<int> res1=nt1.convolution(a,b);
	vector<int> res4=nt4.convolution(a,b);
	vector<int> res9=nt9.convolution(a,b);
	vector<int> res(res1.size());
	for(int i=0;i<res1.size();i++){
		vector<int> eq={res1[i],res4[i],res9[i]};
		vector<int> coef=mod_equations(eq,p);
		res[i]=(coef[0]+1LL*coef[1]*p[0]%mod+1LL*coef[2]*p[0]%mod*p[1]%mod)%mod;
	}
	return res;
}

int fs=505050;
vector<long long> fact(fs),ifact(fs);
long long binom(int a,int b,long long mod){
	if(a<b) return 0;
	return fact[a]*ifact[b]%mod*ifact[a-b]%mod;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n,k;
	cin >> n >> k;
	vector<long long> a(k);
	for(int i=0;i<k;i++) cin >> a[i];
	
	long long mod=1000000007;
	
	fact[0]=1;
	for(int i=1;i<fs;i++) fact[i]=fact[i-1]*i%mod;
	ifact[fs-1]=inv(fact[fs-1],mod);
	for(int i=fs-1;i>0;i--) ifact[i-1]=ifact[i]*i%mod;
	
	long long res=0;
	vector<int> cur(1,1);
	for(int i=0;i<k;i++){
		vector<int> te(n+1);
		for(int j=0;j<=n;j++){
			if(a[i]<j) break;
			long long v=binom(n-j,a[i]-j,mod)*ifact[j]%mod;
			te[j]=v;
		}
		cur=convolution(cur,te,mod);
		if(cur.size()>=(n+4)) cur.resize(n+4);
	}
	cout << cur[n]*fact[n]%mod << "\n";
	return 0;
}

Measured memory_bytes: 8192