#include <bits/stdc++.h>
using namespace std;

const int P = 1000000007;
int n, k, binom[1005][1005], dp[25][1005];

int main() {
	scanf("%d%d", &n, &k);
	for (int i = 0; i <= n; ++i)
		for (int j = binom[i][0] = 1; j <= i; ++j)
			binom[i][j] = (binom[i - 1][j] + binom[i - 1][j - 1]) % P;
	dp[0][0] = 1;
	for (int i = 1, d; i <= k; ++i) {
		scanf("%d", &d);
		for (int j = 0; j <= n; ++j)
			if (dp[i - 1][j])
				for (int k = 0; k <= d && j + k <= n; ++k)
					dp[i][j + k] = (dp[i][j + k] + 1ll * dp[i - 1][j] * binom[n - j][k] % P * binom[n - k][d - k]) % P;
	}
	printf("%d\n", dp[k][n]);
}
