#Lutece3020. 黑板上的数
黑板上的数
Migrated from Lutece 3020 黑板上的数
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
我们定义 为最小的未出现在多重集 中的数,例如 $\mathrm{mex} (\{1,1,4,5,1,4\})=0,\mathrm{mex} (\{1,9,1,9,8,1,0\})=2$。
现在黑板上有 个非负整数,第 个为 。
我们规定一次操作为:选择黑板上的 个或更多个数,令这些数的多重集为 ,将 写在黑板上。
请你求出在执行 次操作后,黑板上的数构成的多重集会有多少种,结果对 取模。
Input
第一行包括两个整数 。
第二行包括 个整数,。
Output
输出一个整数代表答案。
Samples
3 1
0 1 3
3
6 6
1 1 4 5 1 4
114
Note
第一个样例中,可能得到的多重集有 。
Resources
2023 UESTC ICPC Training for Math