#abc276g. [abc276_g]Count Sequences
[abc276_g]Count Sequences
Problem Statement
Find the number of sequences of integers with terms, , that satisfy the following conditions, modulo .
- $0 \\leq a_1 \\leq a_2 \\leq \\ldots \\leq a_N \\leq M$.
- For each , the remainder when is divided by is different from the remainder when is divided by .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 4
Sample Output 1
8
Here are the eight sequences that satisfy the conditions.
Sample Input 2
276 10000000
Sample Output 2
909213205
Be sure to find the count modulo .