Ural programmers are scattered around the whole world. Programmer Alexey, for example, lives in the Valley and develops C++ program debugging tools at Google.
One of his concerns is predicting possible memory leaks.
Alexey has scrutinized the occurring issues for long and has reached an understanding that memory leak happens when and only when the system comes into the following state: zero and first memory register contain values 0 and 1 correspondingly, and values at other registers are related according to the equation x_{n} = (x_{n−1} + x_{n−2}) mod p, where n, n−1, n−2 are memory register numbers.
If Alexey’s program finds a value x_{i} at a register i, it considers current situation hazardous and reads the value of the next register i+1 just to be safe. If it matches x_{i+1}, the situation is considered Extremely Hazardous.
Once upon a time Alexey’s program failed, the input was x — the value of some register, but the number of the register was not identified. Find out whether a hazardous situation is possible. if yes, find all possible values of register number k which will cause a hazardous situation, and for each k find the value y_{k} of the next register leading the program to consider the situation Extremely Hazardous.
Notice, that there are powerful servers at Google, with 10^{100} memory registers.
Input
The first line contains two integer numbers p (2 ≤ p < 10^{9}) and x (0 ≤ x < p). It is guaranteed that p is a prime number.
Output
If the situation may be hazardous, in the first line output the number of different values of y_{k}.
In the second line list these values in an ascending order separated by space.
If the situation cannot be hazardous, in the only line output number 0.
Samples
input  output 

7 0
 2
1 6

7 3
 1
5

11 4
 0

Problem Author: Vladislav Isenbaev