#include <stdio.h>
long long p = 1000000007;
long long kai[1001];
long long inv[1001];
long long ikai[1001];
long long dp[21][1001];
long long n, k, a[20], x;
int main() {
	kai[0] = 1;
	for (int i = 1; i <= 1000; i++) {
		kai[i] = kai[i - 1] * i % p;
	}
	inv[1] = 1;
	for (int i = 2; i <= 1000; i++) {
		inv[i] = (p - inv[p % i]) * (p / i) % p;
	}
	ikai[0] = 1;
	for (int i = 1; i <= 1000; i++) {
		ikai[i] = ikai[i - 1] * inv[i] % p;
	}
	scanf("%lld%lld", &n, &k);
	for (long long i = 0; i < k; i++) {
		scanf("%lld", a + i);
	}
	dp[0][0] = 1;
	for (long long l = 0; l < k; l++) {
		for (long long i = 0; i <= n; i++) {
			for (long long j = 0; j <= a[l]; j++) {
				if (i + j <= n) {
					x = kai[n - i] * kai[n - j] % p;
					x *= ikai[n - a[l]] * ikai[n - i - j] % p;
					x %= p;
					x *= ikai[j] * ikai[a[l] - j] % p;
					x %= p;
					dp[l + 1][i + j] += x * dp[l][i] % p;
					dp[l + 1][i + j] %= p;
				}
			}
		}
	}
	printf("%lld\n", dp[k][n]);
}