#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
int n, m, a;
struct mint{
	static constexpr int mod = 1e9+7;
	int x;
	mint(ll x=0): x((x %= mod) < 0 ? x+mod : x){}
	mint operator-(){return mint(mod-x);}
	mint &operator+=(const mint &n){if((x += n.x) >= mod) x -= mod; return *this;}
	mint &operator-=(const mint &n){if((x += n.x) >= mod) x -= mod; return *this;}
	mint &operator*=(const mint &n){x = (ll)x * n.x % mod; return *this;}
	mint &operator/=(const mint &n){return *this *= n.inv();}
	mint &operator^=(const mint &n){
		mint ret{1}, tmp{x};
		for(int t = n.x; t; t >>= 1){
			if(t&1) ret *= tmp;
			tmp *= tmp;
		}
		return *this = ret;
	}
	mint inv() const{return *this ^ (mod - 2);}
	mint operator+(const mint &n){return mint(*this) += n;}
	mint operator-(const mint &n){return mint(*this) -= n;}
	mint operator*(const mint &n){return mint(*this) *= n;}
	mint operator/(const mint &n){return mint(*this) /= n;}
	mint operator^(const mint &n) const{return mint(*this) ^= n;}
} dp[1005];
mint exp(mint b, int n){
	mint res = 1;
	for(; n; n/=2,b*=b) if(n%2) res *= b;
	return res;
}
mint fact[1005] = {1}, invf[1005];
void setcomb(int n){
	for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
	invf[n] =  fact[n].inv();
	for(int i = n; i > 0; i--) invf[i-1] = invf[i] * i;
}
inline mint comb(int a, int b){return fact[a] * invf[a-b] * invf[b];}
int main(){
	scanf("%d%d", &n, &m);
	dp[0] = 1;
	setcomb(n);
	rep(i,m){
		scanf("%d", &a);
		mint nw[1005] = {};
		rep(j,a+1) rep(k,n+1-j) nw[k+j] += dp[k] * comb(n-k,j) * comb(n-j,a-j);
		rep(j,n+1) dp[j] = nw[j];
	}
	printf("%d\n", dp[n].x);
}