#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

#define P 1000000007
#define N_MAX 10000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
  if(n<0||k<0||n<k) return 0;
  return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
  fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
  for(int i = 2; i <= N_MAX; i++){
    fac[i] = (fac[i-1]*i)%P;
    inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
    finv[i] = (finv[i-1]*inv[i])%P;
  }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}
int main(int argc, char const *argv[]) {
  init();
  ll n, k;scanf("%lld %lld", &n, &k);
  vll a(k);re(i, k) scanf("%lld", &a[i]);
  vvl dp = VV(k+1, n+1, 0, ll);
  dp[0][0] = 1;
  ll ans = fac[n];

  for(int i=1;i<=k;i++){
    for(int j=0;j<=n;j++){
      for(int d=0;d<=j;d++){
        ll prev = dp[i-1][j-d];
        ll x = pp(comb(n-d, a[i-1]-d), finv[d]);
        dp[i][j] = (dp[i][j] + pp(prev, x))%P;
      }
    }
  }
  std::cout << pp(ans, dp[k][n]) << '\n';
  return 0;
}
