AT_past202309_j 除夜の鐘
Description
The New Year's bell rang $ N $ times at equal intervals. More specifically, the bell rang at times $ t, d+t, 2d+t, \ldots, (N-1)d+t $ for some positive integer $ d $ and integer $ t $ .
Takahashi heard the bell ring at times $ A_1, A_2, \ldots, A_K $ . Although it is certain that the bell actually rang when Takahashi heard the sound, the bell may have also rung at other times.
You are given $ N $ , $ K $ , and $ A_1, A_2, \ldots, A_K $ . List all possible values for the positive integer $ d $ **in ascending order**.
Under the constraints of this problem, it can be proved that the number of possible values for $ d $ is finite.
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ K $ $ A_1 $ $ A_2 $ $ \ldots $ $ A_K $
Output Format
List all possible values for the positive integers $ d $ in ascending order in the following format:
> $ M $ $ d_1 $ $ d_2 $ $ \ldots $ $ d_M $
That is, the first line should contain $ M $ , the number of possible values for $ d $ , and the second line should contain $ (d_1, d_2, \ldots, d_M) $ , all possible values for $ d $ in ascending order, with spaces in between.
Explanation/Hint
### Sample Explanation 1
There are two possible values for $ d $ : $ 2 $ and $ 4 $ .
- For $ d = 2 $ , it is possible that the bell rang eight times, for instance, at times $ 3, 5, 7, 9, 11, 13, 15, 17 $ .
- For $ d = 4 $ , it is possible that the bell rang eight times, for instance, at times $ -5, -1, 3, 7, 11, 15, 19, 23 $ .
### Constraints
- $ 2 \leq N \leq 10^9 $
- $ 2 \leq K \leq \min \lbrace N, 2 \times 10^5 \rbrace $
- $ 0 \leq A_1 \lt A_2 \lt \cdots \lt A_K \leq 10^9 $
- All input values are integers.
- There is at least one possible value for the positive integer $ d $ .