#DWACON6THPRELIMSC. Cookie Distribution

Cookie Distribution

Score : 800800 points

Problem Statement

There are NN children, numbered 1,2,,N1,2,\ldots,N. In the next KK days, we will give them some cookies. In the ii-th day, we will choose aia_i children among the NN with equal probability, and give one cookie to each child chosen. (We make these KK choices independently.)

Let us define the happiness of the children as c1×c2××cNc_1 \times c_2 \times \ldots \times c_N, where cic_i is the number of cookies received by Child ii in the KK 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 (109+7)(10^{9}+7).

Notes

(nk)\binom{n}{k} denotes the number of possible choices of kk objects out of given distinct nn objects, disregarding order.

Constraints

  • 1N10001 \leq N \leq 1000
  • 1K201 \leq K \leq 20
  • 1aiN1 \leq a_i \leq N

Input

Input is given from Standard Input in the following format:

NN KK

a1a_1 a2a_2 \ldots aKa_K

Output

Print the answer.

3 2
3 2
12
  • On the first day, all the children 11, 22, and 33 receive one cookie.
  • On the second day, two out of the three children 11, 22, and 33 receive one cookie.
  • Their happiness is 44 in any case, so the expected happiness is 44. Print this value multiplied by (33)×(32)\binom{3}{3} \times \binom{3}{2}, which is 1212.
856 16
399 263 665 432 206 61 784 548 422 313 848 478 827 26 398 63
337587117
  • Find the expected value multiplied by $\binom{N}{a_1} \times \binom{N}{a_2} \times \ldots \times \binom{N}{a_K}$, modulo (109+7)(10^9+7).