#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

constexpr ll modPow(ll a, ll b, ll c) {
	return (b&1) ? (a * modPow(a, b-1, c) % c)
		: (b ? modPow(a*a % c, b/2, c) : 1);
}

template<int P>
struct FactPrecalc {
	private:
		vector<int> fact;
		vector<int> inv_fact;
	public:
		FactPrecalc(int n) : fact(n+1, 1), inv_fact(n+1, 1) {
			for (int i = 2; i <= n; ++i) fact[i] = (ll)fact[i-1] * i % P;
			inv_fact[n] = modPow(fact[n], P-2, P);
			for (int i = n-1; i >= 0; --i) inv_fact[i] = (ll)inv_fact[i+1] * (i+1) % P;
		}
		ll operator()(int a, int b) const {
			if (a < b) return 0;
			ll div = (ll)inv_fact[a-b] * inv_fact[b] % P;
			return fact[a] * div % P;
		}
		ll operator[](int i) const { return fact[i]; }
		ll inv(int i) const { return inv_fact[i]; }
};

const int N = 1000;
ll dp[N+1];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n, k;
	cin >> n >> k;
	FactPrecalc<MOD> fp(n);

	dp[0] = 1;
	for (; k; --k) {
		int a;
		cin >> a;
		for (int i = n; i >= 0; --i) {
			for (int j = min(n, i+a); j > i; --j) {
				int d = j-i;
				ll mult = fp(n-i, d) * fp(n-d, a-d) % MOD;
				dp[j] = (dp[j] + mult * dp[i]) % MOD;
			}
			dp[i] = dp[i] * fp(n, a) % MOD;
		}
	}
	cout << dp[n] << '\n';
}
