#include <bits/stdc++.h>
using namespace std;
#define ll long long 
const int N = 1e3 + 5, mod = 1e9 + 7;
int n, k, a[N];
ll f[N], inv[N];
ll dp[30][N];

ll C(ll n, ll m) {
    return f[n] * inv[n - m] % mod * inv[m] % mod;
}

int main() {
    f[0] = 1, inv[0] = inv[1] = 1;
    for (int i = 1; i < N; ++i) f[i] = f[i - 1] * i % mod;
    for (int i = 2; i < N; ++i) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
    for (int i = 2; i < N; ++i) inv[i] = inv[i] * inv[i - 1] % mod;
    scanf("%d %d", &n, &k);
    for (int i = 1; i <= k; ++i) scanf("%d", &a[i]);
    dp[0][0] = 1;
    for (int i = 1; i <= k; ++i) {
        for (int j = 0; j <= n; ++j) {
            for (int k = 0; k <= min(j, a[i]); ++k) {
                dp[i][j] = (dp[i][j] + dp[i - 1][j - k] * C(n - j + k, k) % mod * C(n - k, a[i] - k) % mod) % mod;
            }
        }
    }
    cout << dp[k][n] << endl;
    return 0;
}