#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

//aのb乗
int beki(int a,int b){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=mod(x*a);
		}
		a=mod(a*a);
		b>>=1;
	}
	return x;
}

//aの逆元
int gyakugen(int a){
	return beki(a,modulo-2);
}

struct combi{
	deque<int> kaijou;
	deque<int> kaijou_;
	
	combi(int n){
		kaijou.push_back(1);
		for(int i=1;i<=n;i++){
			kaijou.push_back(mod(kaijou[i-1]*i));
		}
		
		int b=gyakugen(kaijou[n]);
		
		kaijou_.push_front(b);
		for(int i=1;i<=n;i++){
			int k=n+1-i;
			kaijou_.push_front(mod(kaijou_[0]*k));
		}
	}
	
	int combination(int n,int r){
		if(r>n)return 0;
		int a = mod(kaijou[n]*kaijou_[r]);
		a=mod(a*kaijou_[n-r]);
		return a;
	}
	
	int junretsu(int a,int b){
		int x = mod(kaijou_[a]*kaijou_[b]);
		x=mod(x*kaijou[a+b]);
		return x;
	}
	
};

int main(){
	
	int N,K;
	cin>>N>>K;
	
	vector<int> a(K);
	for(int i=0;i<K;i++)cin>>a[i];
	
	vector<vector<int>> dp(K+1,vector<int>(N+1,0));
	
	dp[0][0] = 1;
	
	combi C(2000);
	
	for(int i=0;i<K;i++){
		for(int j=0;j<=N;j++){
			for(int k=0;k<=a[i];k++){
				int x = k;
				int y = a[i] - k;
				int new_i = i+1;
				int new_j = j+x;
				if(new_j>N)continue;
				int r = 1;
				r = mod(r * C.combination(N-j,x));
				r = mod(r * C.combination(N-x,y));
				r = mod(r * dp[i][j]);
				dp[new_i][new_j] = mod(dp[new_i][new_j] + r);
			}
		}
	}
	
	int ans = dp[K][N];

	cout<<ans<<endl;
	
    return 0;
}
