#P1358. 扑克牌

    ID: 355 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>数学递推福建省历届夏令营枚举,暴力背包

扑克牌

Description

Combinatorics is an important branch of mathematics that studies discrete objects. It mainly focuses on problems about the existence, counting, and construction of configurations (also called combinatorial models) that satisfy certain conditions. Its main topics include combinatorial counting, combinatorial design, combinatorial matrices, and combinatorial optimization.

With the rapid development of computer science, the importance of combinatorics has become more and more evident, because the core of computer science is using algorithms to process discrete data.

Today we study an interesting and simple counting problem in combinatorics:

From a deck of nn distinct playing cards, deal to mm people; the ii-th person receives aia_i cards. Find the number of ways to do this. This number may be very large; please output the result modulo 1000710007.

Input Format

The first line contains two integers n,mn, m.

The second line contains mm integers aia_i.

Output Format

Output the result modulo 1000710007.

5 2
3 1

20

20 19
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

8707

Hint

For 50%50\% of the testdata: ai=1a_i = 1.

For 100%100\% of the testdata: 1n1041 \leq n \leq 10^4, 1m1001 \leq m \leq 100, 0ai1000 \leq a_i \leq 100.

Translated by ChatGPT 5