#include <iostream>
#define rep(i, a, n) for (int i = a; i <= n; ++i)
using namespace std;
const int m = 1000000007;
int N, K, a[1001], c[1001][1001];
long d[21][1001];
int main() {
	cin >> N >> K;
	rep(k, 1, K) cin >> a[k];
	rep(n, 0, N) rep(r, 0, n) c[n][r] = r == 0 ? 1 : (c[n - 1][r - 1] + c[n - 1][r]) % m;
	d[0][0] = 1;
	rep(k, 1, K) rep(n, 0, N) rep(x, 0, min(n, a[k])) d[k][n] = (d[k][n] + d[k - 1][n - x] * c[n][x] % m * c[N - x][a[k] - x]) % m;
	cout << d[K][N] << endl;
}
