#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int64_t f(int64_t x,int64_t y){
if(y==0)
  return 1;
  else if(y%2==0)
    return (f(x,y/2)*f(x,y/2))%mod;
  else
    return (x*((f(x,y/2)*f(x,y/2))%mod))%mod;
}
int main(){
 int64_t N,K;cin>>N>>K;
  vector<int64_t>A(K);
  for(int i=0;i<K;i++)
    cin>>A.at(i);
  vector<int64_t>r(1001);
  for(int64_t i=0;i<=1000;i++)
    r.at(i)=f(i,mod-2);
  
  vector<int64_t>CombN(1+N);
  CombN[0]=1;
  for(int i=1;i<=N;i++)
    CombN[i]=(((CombN[i-1]*(N+1-i))%mod)*r[i])%mod;
  vector<vector<int64_t>>dp(1+K,vector<int64_t>(1+N,0));
  dp[0][0]=1;
  for(int i=1;i<=K;i++)
    for(int j=0;j<=N;j++){
    int64_t Min;
      if(j<=A[i-1])Min=j;
      else
        Min=A[i-1];
      vector<int64_t>C(1+Min);C[0]=1;
      vector<int64_t>D(1+Min);D[0]=CombN[N-A[i-1]];
      for(int64_t  k=1;k<=Min;k++)
        C[k]=(((C[k-1]*(N+k-j))%mod)*r[k])%mod;
      for(int64_t k=1;k<=Min;k++)
        D[k]=(((D[k-1]*(A[i-1]-k+1))%mod)*r[N+1-k])%mod;
      int64_t sum=0;
      for(int64_t l=0;l<=Min;l++){
      int64_t a=(C[l]*D[l])%mod;
        a=(a*dp[i-1][j-l])%mod;
      sum=(sum+a)%mod;
      }dp[i][j]=sum;
        
      
      }cout<<dp[K][N]<<endl;
   return 0;
}