atcoder#ABC221H. [ABC221H] Count Multiset
[ABC221H] Count Multiset
Score : points
Problem Statement
Given are positive integers and .
For each , find the following number and print it modulo .
- The number of multisets containing positive integers that satisfy both of the following conditions:- the sum of the elements of is ;
- for every positive integer , contains at most occurrences of .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines; the -th line should contain the answer for the case .
4 2
1
2
1
0
- For , there is one multiset that satisfies the conditions: .
- For , there are two multisets that satisfy the conditions: and .
- For , there is one multiset that satisfies the conditions: .
- For , there is no multiset that satisfies the conditions.
7 7
1
3
4
3
2
1
1