#P6195. [EER1] 迫害
[EER1] 迫害
Description
There are people, and X wants to persecute these people.
Each of these people has a number, from to .
X has numbers: of them are , and the other numbers have values that X can choose (once each number is fixed, it cannot be changed).
X can persecute a person if and only if he can choose some of the numbers in his hand whose sum equals that person's number. If so, the persecution succeeds. (The numbers are not consumed.)
Since X has great power and is very evil, he wants to carry out the persecutions starting from person , one by one.
Since Little Z is also among those being persecuted, he is very nervous and wants you to tell him: starting from the first person, what is the maximum number of consecutive people X can persecute?
Because there are too many persecuted people, please output the answer modulo .
Input Format
The first line contains two integers , meaning X has numbers equal to , and numbers whose values can be chosen.
Output Format
Tell Little Z how many people X can persecute.
1 2
7
2 2
11
Hint
Sample 1 Explanation
X chooses two numbers as and . It can be seen that he can persecute people consecutively.
Sample 2 Explanation
X chooses two numbers as and . It can be seen that he can persecute people consecutively.
Constraints
This problem uses bundled testdata.
- Subtask 1 (50 points): , .
- Subtask 2 (30 points): It is guaranteed that the answer is within before taking modulo.
- Subtask 3 (20 points): No special restrictions.
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号