#include <iostream>
using namespace std;

long long nr[1009][1009];
long long nr_inv[1009][1009];
long long mod = 1000000007;

long long modpow(long long a, long long b, long long m) {
	long long p = 1, q = a;
	for (int i = 0; i < 32; i++) {
		if ((b & (1LL << i)) != 0) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

void init() {
	for (int i = 0; i <= 1000; i++) {
		for (int j = 0; j <= 1000; j++) {
			if (i == 0 || j == 0) nr[i][j] = 1;
			else nr[i][j] = (nr[i][j - 1] + nr[i - 1][j]) % mod;
		}
	}
	for (int i = 0; i <= 1000; i++) {
		for (int j = 0; j <= 1000; j++) {
			nr_inv[i][j] = modpow(nr[i][j], mod - 2, mod);
		}
	}
}

long long ncr(long long n, long long r) {
	if (r < 0 || n < r) return 0;
	return nr[n - r][r];
}

long long ncrinv(long long n, long long r) {
	if (r < 0 || n < r) return 0;
	return nr_inv[n - r][r];
}

long long N, K, A[22];
long long dp[22][1009];

int main() {
	init();

	cin >> N >> K;
	for (int i = 1; i <= K; i++) cin >> A[i];

	dp[1][N] = 1;
	for (int i = 1; i <= K; i++) {
		for (int j = 0; j <= N; j++) {
			for (int k = 0; k <= j; k++) {
				long long prob = ncr(N - (j - k), A[i] - (j - k)) * ncrinv(N, A[i]) % mod;
				prob *= ncr(j, k); prob %= mod;
				dp[i + 1][k] += dp[i][j] * prob;
				dp[i + 1][k] %= mod;
			}
		}
	}

	long long val = dp[K + 1][0];
	for (int i = 1; i <= K; i++) { val *= ncr(N, A[i]); val %= mod; }
	cout << val << endl;
	return 0;
}