#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
const int maxn = 2e3 + 33, mod = 1e9 + 7;
ll f[maxn], inv[maxn];
void setup() {
	f[0] = inv[0] = 1;
	for(int i = 1; i < maxn; i++) {
		f[i] = (f[i-1]*i)%mod;
		if(i==1) inv[i] = 1;
		else inv[i] = (mod - inv[mod%i]*(mod/i)%mod)%mod;
	}
	for(int i = 1; i < maxn; i++) inv[i] = (inv[i]*inv[i-1])%mod;
}
ll nck(ll n, ll k) {
	ll r = f[n]*inv[k]%mod;
	return r*inv[n-k]%mod;
}
int n, k, a[22];
ll dp[22][maxn];//dp day/left

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	setup();
	cin >> n >> k;
	for(int i = 0; i < k; i++) cin >> a[i];
	dp[0][n] = 1;
	for(int i = 0; i < k; i++) {
		for(int lft = 0; lft <= n; lft++) {
			for(int ch = 0; ch <= min(lft, a[i]); ch++) {
				(dp[i+1][lft-ch] += (dp[i][lft]*nck(n-ch, a[i]-ch)%mod)*inv[ch]%mod) %= mod;
			}
		}
	}
	cout << (f[n]*dp[k][0]%mod);
}

