#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i++)
#define re0(i, n) for (rint i = 0; i < (int) n; i++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template <class T> inline void read(T &x) {
	x = 0; char c = getchar(); int f = 0;
	for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
	for (; c >= '0' && c <= '9'; x = x * 10 + c - '0', c = getchar());
	if (f) x = -x;
}
namespace {
    const int mo = 1e9 + 7;
    inline int add(int x, int y) { x += y; return x >= mo ? x - mo : x; }
    inline int sub(int x, int y) { x -= y; return x < 0 ? x + mo : x; }
    inline int mul(int x, int y) { return (lo) x * y % mo; }
    inline int power(int a, int k = mo - 2) {
		int ans = 1;
		for (; k; k >>= 1, a = mul(a, a))
			if (k & 1) ans = mul(ans, a);
		return ans;
    }
	inline void U(int &x, int y) { x = add(x, y); } 
}

const int N = 2333;
int n, K, a[N], C[N][N];

int main(void) {
	read(n); read(K);
	rep (i, K) read(a[i]);
	re0 (i, n + 2) C[i][0] = 1;
	rep (i, n) rep (j, i)
		C[i][j] = add(C[i - 1][j - 1], C[i - 1][j]);
	vector <int> dp(n + 2, 0);
	dp[0] = 1;
	rep (i, K) {
		vector <int> new_dp(n + 2, 0);
		for (int sz = 0; sz <= n; sz++)
			for (int k = 0; k <= a[i] && k + sz <= n; k++) {
				U(new_dp[sz + k], mul(dp[sz], mul(C[n - sz][k], C[n - k][a[i] - k])));
			}
		swap(dp, new_dp);
	}
	cout << dp[n] << "\n";
			
}
