题目描述
Problem Background
NOIP2014 Senior Group D2T3
Problem Description
Given a polynomial equation:
$$a_0 + a_1x + a_2x^2 + \cdots + a_nx^n = 0$$
Find the integer solutions of this equation within the range $[1, m]$ (where $n$ and $m$ are positive integers).
Input Format
The input consists of $n + 2$ lines.
The first line contains two integers $n$ and $m$, separated by a space.
The next $n+1$ lines each contain one integer, representing $a_0, a_1, a_2, \ldots, a_n$ in order.
Output Format
The first line should output the number of integer solutions within the range $[1, m]$.
Each subsequent line should output one integer solution within the range $[1, m]$, in ascending order.
Sample Input and Output
Sample Input #1
2 10
1
-2
1
Sample Output #1
1
1
Sample Input #2
2 10
2
-3
1
Sample Output #2
2
1
2
Sample Input #3
2 10
1
3
2
Sample Output #3
0
Notes
For $30\%$ of the data: $0 < n \le 2, |a_i| \le 100, a_n \neq 0, m < 100$.
For $50\%$ of the data: $0 < n \le 100, |a_i| \le 10^{100}, a_n \neq 0, m < 100$.
For $70\%$ of the data: $0 < n \le 100, |a_i| \le 10^{10000}, a_n \neq 0, m < 10^4$.
For $100\%$ of the data: $0 < n \le 100, |a_i| \le 10^{10000}, a_n \neq 0, m < 10^6$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分