M=10**9+7;n,k,*A=map(int,open(0).read().split());B=[1];I=[1]*(n+1)
for i in range(1,n+1):B+=[B[-1]*i%M]
for i in range(n+1,0,-1):I[i-1]=pow(B[n],M-2,M)%M if i>n else I[i]*i%M
C=lambda n,k:(B[n]*I[k]*I[n-k],0)[k<0];F=[[0]*(n+1)for _ in"_"*(k+1)];F[0][0]=1
for i in range(k):
 for j in range(n+1):
  for m in range(j+1):F[i+1][j]+=C(j,m)*F[i][m]*C(n-j+m,A[i]-j+m)%M
print(F[k][n]%M)