#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>


constexpr long long int MOD = 1000000007;
int main() {
	int n, day; std::cin >> n >> day;
	std::vector<int> cookie(day); for (auto& a : cookie) std::cin >> a;
	std::vector<long long int> factorial(n + 1, 1), inv(n + 1, 1), inv_factorial(n + 1, 1), power(n + 1, 1); power[1] = 2;
	for (auto i = 2; i <= n; ++i) {
		factorial[i] = i * factorial[i - 1] % MOD;
		inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
		inv_factorial[i] = inv[i] * inv_factorial[i - 1] % MOD;
		power[i] = 2 * power[i - 1] % MOD;
	}
	std::vector<std::vector<long long int>> dp(day, std::vector<long long int>(n + 1, 0));
	for (auto i = 0; i <= cookie.front(); ++i) {
		dp[0][i] = factorial[n] * inv_factorial[cookie.front()] % MOD * inv_factorial[n - cookie.front()] % MOD * factorial[cookie.front()] % MOD * inv_factorial[i] % MOD * inv_factorial[cookie.front() - i] % MOD;
		dp[0][i] %= MOD;
	}
	for (auto i = 1; i < day; ++i) {
		for (auto j = 0; j <= cookie[i]; ++j) {
			for (auto k = 0; k + j <= n; ++k) {
				dp[i][j + k] += dp[i - 1][k] * 
					factorial[n - k] % MOD * inv_factorial[j] % MOD * inv_factorial[n - k - j] % MOD *
					factorial[n - j] % MOD * inv_factorial[cookie[i] - j] % MOD * inv_factorial[n - cookie[i]] % MOD;
				dp[i][j + k] %= MOD;
			}
		}
	}
	std::cout << dp.back().back() << std::endl;
}