#include <bits/stdc++.h>
using namespace std;
inline int read(){
    int x = 0; char c = getchar();
    while (!isdigit(c)) c = getchar();
    while (isdigit(c)) x = x * 10 + c - '0',c = getchar();
    return x;
}
template <typename T> void read(T &x){
	x = 0; int f = 1; char ch = getchar();
	while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
	x *= f;
}
inline void write(int x){if (x > 9) write(x/10); putchar(x%10+'0'); }

const int N = 1050,K = 20 + 5,P = 1e9 + 7;
int n,k,a[K];
int fac[N],nfac[N],inv[N];
inline int C(int n,int m){ return (n<m||n<0||m<0) ? 0 : 1ll*fac[n]*nfac[m]%P*nfac[n-m]%P; }
int t[K][N];
int dp[K][N];
int main(){
	int i,j,e;
	read(n),read(k); for (i = 1; i <= k; ++i) read(a[i]);
	inv[0] = fac[0] = nfac[0] = inv[1] = fac[1] = nfac[1] = 1;
	for (i = 2; i <= n; ++i){
		fac[i] = 1ll*fac[i-1]*i%P;
		inv[i] = 1ll*(P-P/i)*inv[P%i]%P;
		nfac[i] = 1ll*nfac[i-1]*inv[i]%P;
	} 
	for (i = 1; i <= k; ++i)
	for (j = 0; j <= n; ++j) t[i][j] = 1ll*C(n-j,a[i]-j)*nfac[j]%P;
	dp[0][0] = 1;
	for (i = 1; i <= k; ++i)
	for (j = 0; j <= n; ++j){
		dp[i][j] = 0;
		for (e = 0; e <= j; ++e) dp[i][j] = (dp[i][j] + 1ll * t[i][e] * dp[i-1][j-e]) % P;
	}
	int ans = 1ll * dp[k][n] * fac[n] % P; 
    cout << ans << endl;
	return 0;
}