#P6189. [NOI Online #1 入门组] 跑步

[NOI Online #1 入门组] 跑步

Problem Description

Little H is a child who loves sports. One day, he wants to make a running plan for himself. Little H plans to run nn meters in total. In the ii-th minute (i1i \geq 1), he will run xix_i meters (xix_i is a positive integer), but the total duration is not fixed.

As the running time increases, Little H will get more and more tired, so his plan must satisfy that for any ii (i>1i > 1), xixi1x_i \leq x_{i-1}.

Now Little H wants to know how many different plans satisfy the conditions. Two plans are different if and only if the total duration is different, or there exists an ii such that xix_i is different in the two plans.

Since the final answer may be very large, you only need to output the result modulo pp.

Input Format

The input contains only one line with two integers, representing the total meters nn and the modulus pp.

Output Format

Output one line with one integer, representing the answer modulo pp.

4 44

5
66 666666

323522
66666 66666666

45183149

Hint

Explanation of Sample Input/Output 1

The five different plans are: {1,1,1,1}\{1,1,1,1\}, {2,1,1}\{2,1,1\}, {3,1}\{3,1\}, {2,2}\{2,2\}, {4}\{4\}.


Constraints

This problem has 1010 test points. The information for each test point is shown in the table below.

Test Point ID nn \leq Test Point ID nn \leq
11 55 66 2×1032\times 10^3
22 1010 77 5×1035\times 10^3
33 5050 88 2×1042\times 10^4
44 100100 99 5×1045\times 10^4
55 500500 1010 10510^5

For all test points, it is guaranteed that 1n1051 \leq n \leq 10^5, 1p<2301 \leq p < 2^{30}.

Translated by ChatGPT 5