#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;


class modInt{
    ll value;
    static const ll mod = 1000000007;

public:
    modInt(ll x=0): value{x % mod}{}

    inline modInt& operator+=(modInt x){
        value = (value + x.value) % mod;
        return *this;
    }

    inline modInt& operator-=(modInt x){
        value = (value + mod - x.value) % mod;
        return *this;
    }

    inline modInt& operator*=(modInt x){
        value = (value * x.value) % mod;
        return *this;
    }


    inline modInt operator/=(modInt x){
        *this *= x.inv();
        return *this;
    }

    inline modInt pow(ll n){
        modInt res = modInt(1LL);
        modInt x{value};
        while(n > 0){
            if(n & 1)   res *= x;
            x *= x;
            n >>= 1;
        }
        return res;
    }

    inline modInt inv(){
        modInt res = pow(mod-2);
        return res;
    }

    inline ll get(){
        return value;
    }
};

modInt operator+(modInt x, modInt y){
    return x += y;
}

modInt operator-(modInt x, modInt y){
    return x -= y;
}

modInt operator*(modInt x, modInt y){
    return x *= y;
}

modInt operator/(modInt x, modInt y){
    return x /= y;
}

ostream& operator<<(ostream& os, modInt x){
    return os << x.get();
}


class modIntCombinations{
    vector<modInt> factArray;

    void make_fact(ll x){
        for(auto i = factArray.size(); i <= x+1; i++){
            modInt y = factArray[i-1] * i;
            factArray.push_back(y);
        }
    }

public:
    modIntCombinations(){
        factArray.emplace_back(1);
    }

    modInt fact(ll x){
        if(factArray.size() < x+1){
            make_fact(x);
        }
        return factArray[x];
    }

    modInt comb(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k) / fact(n - k);
        }
    }

    modInt perm(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k);
        }
    }
};


int main(){
    ll n, k;   cin >> n >> k;
    vector<ll> a(k);
    for(int i = 0; i < k; i++){
        cin >> a[i];
    }
    vector<vector<modInt>> dp(k+1, vector<modInt>(n+1, 0));

    vector<vector<bool>> exist(n+1, vector<bool>(n+1, false));
    vector<vector<modInt>> v(n+1, vector<modInt>(n+1, 0));
    dp[0][0] = 1;

    modIntCombinations mic{};
    for(int i = 0; i < k; i++){
        for(int j = 0; j <= n; j++){
            if(dp[i][j].get() == 0) continue;
            for(int l = 0; l <= a[i]; l++){
                if(l + j > n)   break;
                modInt c1, c2;
                if(exist[n-j][l]){
                    c1 = v[n-j][l];
                }
                else{
                    c1 = mic.comb(n - j, l);
                    exist[n-j][l] = true;
                    v[n-j][l] = c1;
                }

                if(exist[n-l][a[i]-l]){
                    c2 = v[n-l][a[i]-l];
                }
                else{
                    c2 = mic.comb(n - l, a[i] - l);
                    exist[n-l][a[i]-l] = true;
                    v[n-l][a[i]-l] = c2;
                }


                dp[i+1][j+l] += dp[i][j] * c1 * c2;
//                cout << i+1 << " " << j + l << " " << j << " " << l << " " << dp[i][j] * mic.comb(n - j, l) * mic.comb(n - l, a[i] - l) << endl;
            }
        }
    }
    cout << dp[k][n] << endl;


    return 0;
}


Measured memory_bytes: 8448