output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
      a_1 a_2 \ldots a_K
attempt: import sys
  
  read = sys.stdin.buffer.read
  readline = sys.stdin.buffer.readline
  readlines = sys.stdin.buffer.readlines
  
  import numpy as np
  
  N, K, *A = map(int, read().split())
  
  MOD = 10**9 + 7
  
  
  def cumprod(A, MOD=MOD):
      L = len(A)
      Lsq = int(L**0.5 + 1)
      A = np.resize(A, Lsq**2).reshape(Lsq, Lsq)
      for n in range(1, Lsq):
          A[:, n] *= A[:, n - 1]
          A[:, n] %= MOD
      for n in range(1, Lsq):
          A[n] *= A[n - 1, -1]
          A[n] %= MOD
      return A.ravel()[:L]
  
  
  def make_fact(U, MOD=MOD):
      x = np.arange(U, dtype=np.int64)
      x[0] = 1
      fact = cumprod(x, MOD)
      x = np.arange(U, 0, -1, dtype=np.int64)
      x[0] = pow(int(fact[-1]), MOD - 2, MOD)
      fact_inv = cumprod(x, MOD)[::-1]
      return fact, fact_inv
  
  
  def convolve(f, g, MOD=MOD):
      """
      数列 (多項式) f, g の畳み込みの計算．上下 15 bitずつ分けて計算することで，
      30 bit以下の整数，長さ 250000 程度の数列での計算が正確に行える．
      """
      Lf = len(f)
      Lg = len(g)
      L = Lf + Lg - 1
      fl = f & (1 << 15) - 1
      fh = f >> 15
      gl = g & (1 << 15) - 1
      gh = g >> 15
      if L < (1 << 8):
          conv = lambda f, g: np.convolve(f, g) % MOD
      else:
          fft = np.fft.rfft
          ifft = np.fft.irfft
          fft_len = 1 << L.bit_length()
          conv = (
              lambda f, g: np.rint(ifft(fft(f, fft_len) * fft(g, fft_len))[:L]).astype(
                  np.int64
              )
              % MOD
          )
      x = conv(fl, gl)
      z = conv(fh, gh)
      y = conv(fl + fh, gl + gh)
      return (x + ((y - x - z) << 15) + (z << 30)) % MOD
  
  
  fact, fact_inv = make_fact(10**5)
  
  f = np.zeros(N + 1, np.int64)
  f[0] = 1
  for a in A:
      g = fact[N - a : N + 1] * fact_inv[0 : a + 1] % MOD * fact_inv[N - a] % MOD
      g = g[::-1]
      g *= fact_inv[: len(g)]
      g %= MOD
      f = convolve(f, g)[: N + 1]
  
  f *= fact[: N + 1]
  f %= MOD
  
  answer = f[N]
  print(answer)
  
problem_description: Statement
  
  There are N children, numbered 1,2,\ldots,N. In the next K days, we will give
  them some cookies. In the i-th day, we will choose a_i children among the N
  with equal probability, and give one cookie to each child chosen. (We make
  these K choices independently.)
  
  Let us define the _happiness_ of the children as c_1 \times c_2 \times \ldots
  \times c_N, where c_i is the number of cookies received by Child i in the K
  days. Find the expected happiness multiplied by \binom{N}{a_1} \times
  \binom{N}{a_2} \times \ldots \times \binom{N}{a_K} (we can show that this
  value is an integer), modulo (10^{9}+7).
samples: [{"input": "3 2\n    3 2", "output": "12\n    \n\n  * On the first day, all the children 1, 2, and 3 receive one cookie.\n  * On the second day, two out of the three children 1, 2, and 3 receive one cookie.\n  * Their happiness is 4 in any case, so the expected happiness is 4. Print this value multiplied by \\binom{3}{3} \\times \\binom{3}{2}, which is 12.\n\n* * *"}, {"input": "856 16\n    399 263 665 432 206 61 784 548 422 313 848 478 827 26 398 63", "output": "337587117\n    \n\n  * Find the expected value multiplied by \\binom{N}{a_1} \\times \\binom{N}{a_2} \\times \\ldots \\times \\binom{N}{a_K}, modulo (10^9+7)."}]