#include <bits/stdc++.h>
using namespace std;
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	return (a %= p) >= 0 ? a : a + p;
}

int power(int a, int N){
	if(N == 0) return 1;
	else if(N % 2 == 0) return power(MOD(a * a), N / 2);
	else return MOD(a * power(a, N - 1));
}

int inverse(int a){
	return power(a, p - 2);
}

int fact(int N){
	static vector<int> _fact(1, 1);
	for(int i = _fact.size(); i <= N; i++){
		_fact.push_back(MOD(i * _fact[i - 1]));
	}
	return _fact[N];
}
 
int fact_inv(int N){
	static vector<int> inv(2, 1), _fact_inv(2, 1);
	for(int i = inv.size(); i <= N; i++){
		inv.push_back(MOD(-(p / i) * inv[p % i]));
		_fact_inv.push_back(MOD(inv[i] * _fact_inv[i - 1]));
	}
	return _fact_inv[N];
}
 
int combination(int N, int k){
	if(k < 0 || N < k || N < 0) return 0;
	else return MOD(fact(N) * MOD(fact_inv(N - k) * fact_inv(k)));
}

signed main(){
	int N, K, i, j, k;
	scanf("%lld%lld", &N, &K);
	vector<int> a(K + 1);
	for(i = 1; i <= K; i++){
		scanf("%lld", &a[i]);
	}
	vector<vector<int>> dp(K + 1, vector<int>(N + 1, 0));
	dp[0][0] = 1;
	for(i = 1; i <= K; i++){
		for(j = 0; j <= N; j++){
//			printf("a[i] = %lld\n", a[i]);
			for(k = 0; k <= a[i] && k <= j; k++){
//				printf("k = %lld\n", k);
//				printf("%lld\n", combination(N - j + k, k));
//				printf("%lld\n", combination(N - k, a[i] - k));
				dp[i][j] = MOD(dp[i][j] + MOD(combination(N - j + k, k) * combination(N - k, a[i] - k)) * dp[i - 1][j - k]);
			}
//			printf("dp[%lld][%lld] = %lld\n", i, j, dp[i][j]);
		}
//		printf("\n");
	}
	printf("%lld\n", dp[K][N]);
	return 0;
}