Difficulties


You are lining up nn problems for a contest. Each problem has one of kk difficulty labels. There are aia_i problems with label ii, and a1+a2+⋯+ak=na_1 + a_2 + \cdots + a_k = n.

Problems with the same label are indistinguishable. Problems with different labels are distinct. Count the number of distinct ordered problemsets (sequences of length nn). Since the answer can be large, output it modulo 109+710^9 + 7.

Input

The first line contains two integers nn and kk.

The second line contains kk integers a1,a2,…,aka_1, a_2, \ldots, a_k.

It is guaranteed that a1+a2+⋯+ak=na_1 + a_2 + \cdots + a_k = n.

Output

Print one integer: the number of distinct ordered problemsets, modulo 109+710^9 + 7.

Constraints

  • 1≤k≤n≤1061 \le k \le n \le 10^6
  • 0≤ai≤n0 \le a_i \le n
  • a1+a2+⋯+ak=na_1 + a_2 + \cdots + a_k = n

Example 1

Input 1
3 2
2 1
Output 1
3
Explanation

Write AA for label 11 and BB for label 22. The distinct sequences are AABAAB, ABAABA, and BAABAA.

Example 2

Input 2
4 4
1 1 1 1
Output 2
24
Explanation

Every problem has a distinct label, so every permutation of the 44 problems is distinct: 4!=244! = 24.

Example 3

Input 3
6 3
3 2 1
Output 3
60
Explanation

If the labels were all distinct there would be 6!6! sequences. The three copies of the first label are indistinguishable, as are the two copies of the second, so divide by 6!3! 2! 1!=60\dfrac{6!}{3! \, 2! \, 1!} = 60.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.