#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>

#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <iostream>

#define X first
#define Y second
#define PB push_back
#define TRACE(x) printf("%s = %d\n", #x, x);

/*

           _   _ _____ __  __          _      _      _      _      
     /\   | \ | |_   _|  \/  |   /\   | |    | |    | |    | |     
    /  \  |  \| | | | | \  / |  /  \  | |    | |    | |    | |     
   / /\ \ | . ` | | | | |\/| | / /\ \ | |    | |    | |    | |     
  / ____ \| |\  |_| |_| |  | |/ ____ \| |____| |____| |____| |____ 
 /_/    \_\_| \_|_____|_|  |_/_/    \_\______|______|______|______|
                                                                   
                                                                   
                          ..,co88oc.oo8888cc,..
  o8o.               ..,o8889689ooo888o"88888888oooc..
.88888             .o888896888".88888888o'?888888888889ooo....
a888P          ..c6888969""..,"o888888888o.?8888888888"".ooo8888oo.
088P        ..atc88889"".,oo8o.86888888888o 88988889",o888888888888.
888t  ...coo688889"'.ooo88o88b.'86988988889 8688888'o8888896989^888o
 888888888888"..ooo888968888888  "9o688888' "888988 8888868888'o88888
  ""G8889""'ooo888888888888889 .d8o9889""'   "8688o."88888988"o888888o .
           o8888'""""""""""'   o8688"          88868. 888888.68988888"o8o.
           88888o.              "8888ooo.        '8888. 88888.8898888o"888o.
           "888888'               "888888'          '""8o"8888.8869888oo8888o .
      . :.:::::::::::.: .     . :.::::::::.: .   . : ::.:."8888 "888888888888o
                                                        :..8888,. "88888888888.
                                                        .:o888.o8o.  "866o9888o
                                                         :888.o8888.  "88."89".
                                                        . 89  888888    "88":.
                    atc                                 :.     '8888o
                                                         .       "8888..
                                                                   888888o.
                                                                    "888889,
                                                             . : :.:::::::.: :.

------------------------------------------------
Thank you for visiting https://asciiart.website/
This ASCII pic can be found at
https://asciiart.website/index.php?art=animals/cats


*/

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < int > vi;
typedef vector < ll > vl;
typedef vector < pii > vp;
typedef set < int > si;
typedef set < ll > sl;
typedef set < pii > sp;
typedef pair < ld, ld > pt;

const int N = 1005;
const int K = 21;
const int M = 1e6 + 500;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int LOG = 20;
const int ALP = 30;
const int BASE = 31337;
const double EPS = 1e-9;
const double PI = 3.1415926535;

inline int add(const int &A, const int &B){
	if(A + B >= MOD) return A + B - MOD;
	return A + B;
}

inline int mul(const int &A, const int &B){
	return (ll)A * B % MOD;
}

inline int sub(const int &A, const int &B){
	if(A - B < 0) return A - B + MOD;
	return A - B;
}

inline int pot(const int &A, int B){
	int cur = A, ret = 1;
	for(;B;B >>= 1){
		if(B & 1) ret = mul(ret, cur);
		cur = mul(cur, cur);
	}
	return ret;
}

inline int divv(const int &A, const int &B){
	return mul(A, pot(B, MOD - 2));
}

int ch[N][N];
int dp1[N][K], kol[K];
int dp2[N][K];
int n, m;

void precompute(){
	for(int i = 0;i < N;i++)
		ch[i][i] = 1, ch[i][0] = 1;
	for(int i = 1;i < N;i++){
		for(int j = 1;j < i;j++){
			ch[i][j] = add(ch[i - 1][j - 1], ch[i - 1][j]);
		}
	}
	for(int j = 0;j <= n;j++){
		for(int k = 0;k < m;k++){
			if(j > kol[k]) dp1[j][k] = 0;
			else dp1[j][k] = ch[n - j][kol[k] - j];
			//dp1[j][k] = divv(dp1[j][k], ch[n][kol[k]]);
			//printf("dp[ %d ][ %d ] = %d\n", j, kol[k], dp1[j][k]);
		}
	}
}

int f(int ost, int k){
	if(k == m) return (ost == 0);
	if(dp2[ost][k] != -1) return dp2[ost][k];
	int ret = 0;
	for(int uz = 0;uz <= ost;uz++){
		ret = add(ret, mul(mul(dp1[uz][k], f(ost - uz, k + 1)), ch[ost][uz]));
	}
	return dp2[ost][k] = ret;
}

int main(){
	memset(dp2, -1, sizeof(dp2));
	scanf("%d%d", &n, &m);
	for(int i = 0;i < m;i++)
		scanf("%d", kol + i);
	precompute();
	printf("%d\n", f(n, 0));
	return 0;
}

















Measured memory_bytes: 4352