#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()
#define int long long

const int N = 2000;
const int MOD = 1e9 + 7;

int n, k;
int a[N];

int dp[30][N];

int fact[N], ufact[N], r[N];

int cnk(int n, int k)
{
    return fact[n] * ufact[k] % MOD * ufact[n - k] % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    for (int i = 0; i < k; i++) cin >> a[i];
    r[1] = 1;
    for (int i = 2; i < N; i++) r[i] = MOD - r[MOD % i] * (MOD / i) % MOD;
    fact[0] = 1, ufact[0] = 1;
    for (int i = 1; i < N; i++) fact[i] = fact[i - 1] * i % MOD, ufact[i] = ufact[i - 1] * r[i] % MOD;
    dp[0][0] = fact[n];
    for (int i = 1; i <= k; i++)
    {
        for (int st = 0; st < N - a[i - 1] - 1; st++)
        {
            for (int fn = st; fn <= st + a[i - 1]; fn++)
            {
                int x = fn - st;
                dp[i][fn] = (dp[i][fn] + dp[i - 1][st] * ufact[x] % MOD * cnk(n - x, a[i - 1] - x)) % MOD;
            }
        }
    }
    long long ans = 0;
    for (int st = n; st <= n; st++) ans = (ans + dp[k][st]) % MOD;
    cout << ans;
}
