#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

const long long M = 1000000007;

LL C[1001][1001];
LL S[1001][21];
void solve(long long N, long long K, std::vector<long long> a){
	for(int i=0;i<1001;i++){
		C[i][0]=1;
		for(int j=1;j<=i;j++){
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%M;
		}
	}
	S[0][0]=1;
	for(int k=1;k<=K;k++){
		int d=a[k-1];
		S[0][k]=S[0][k-1]*C[N][d]%M;
		for(int n=1;n<=N;n++){
			for(int c=0;c<=min(d,n);c++){
				S[n][k]+=S[n-c][k-1]*C[n][c]%M*C[N-c][d-c]%M;
				S[n][k]%=M;
			}
			//cerr << n << ", " << k << ": " << S[n][k] << endl;
		}


	}
	cout << S[N][K] << endl;

}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> a(K);
    for(int i = 0 ; i < K ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, K, std::move(a));
    return 0;
}
