def main():
  n,k = map(int,input().split())
  a = list(map(int,input().split()))
  mod = 10**9+7
  rng = 10100
  fctr = [1]
  finv = [1]
  for i in range(1,rng):
    fctr.append(fctr[-1]*i%mod)
  for i in range(1,rng):
    finv.append(pow(fctr[i],mod-2,mod))
  def cmb(n,k):
    if n<0 or k<0:
      return 0
    else:
      return fctr[n]*finv[n-k]*finv[k]%mod
  dp0 = [0 for i in range(n+1)]
  dp1 = [0 for i in range(n+1)]
  dp0[0] = 1
  ans = 0
  for i in range(1,k+1):
    x = a[i-1]
    if i%2:
      for j in range(n+1):
        for t in range(min(n-j,x)+1):
          dp1[j+t] = (dp1[j+t]+dp0[j]*cmb(n-j,t)*cmb(n-t,x-t))%mod
      dp0 = [0 for i in range(n+1)]
    else:
      for j in range(n+1):
        for t in range(min(n-j,x)+1):
          dp0[j+t] = (dp0[j+t]+dp1[j]*cmb(n-j,t)*cmb(n-t,x-t))%mod
      dp1 = [0 for i in range(n+1)]
  if k%2:
    print(dp1[n])
  else:
    print(dp0[n])
main()