#include <iostream>
using namespace std;
typedef long long ll;
const int MAX = 100010;
ll inv[MAX],fact[MAX],fi[MAX];
constexpr ll mod = 1000000007;
void inverse(){
	int i;
	inv[1] = 1;
	for(i=2;i<MAX;i++){
		inv[i] = mod - (mod/i)*inv[mod%i]%mod;
	}
	fact[0] = fi[0] = 1;
	for(i=1;i<MAX;i++){
		fact[i] = fact[i-1]*i%mod;
		fi[i] = (fi[i-1]*inv[i])%mod;
	}
}

ll comb(int n,int k){
	if(n<0 || k<0 || n<k){
		return 0;
	}else{
		return fact[n]%mod*fi[k]%mod*fi[n-k]%mod;
	}
}

ll a[1010],dp[2][1010];
int main(){
	ll i,j,n,k,l;
	cin >> n >> k;
	for(i=0;i<k;i++){
		cin >> a[i];
	}
	inverse();
	dp[0][0] = 1;
	for(i=k - 1;i>=0;i--){
		for(j=0;j<=n;j++){
			ll s = 0;
			for(l=0;l<=j;l++){
				(s += dp[0][j - l]*comb(j,l)%mod*comb(n - l,a[i] - l)%mod) %= mod;
			}
			(dp[1][j] += s) %= mod;
		}
		for(j=0;j<=n;j++){
			dp[0][j] = dp[1][j];
			dp[1][j] = 0;
		}
	}
	cout << dp[0][n] << endl;
}