P2312 [NOIP 2014 Senior] Solve the Equation

Background

NOIP 2014 Senior D2T3.

Description

Given the polynomial equation: $$a_0+a_1x+a_2x^2+\cdots+a_nx^n=0$$ Find all integer solutions of this equation in $[1,m]$ (both $n$ and $m$ are positive integers).

Input Format

The input contains $n + 2$ lines. The first line contains two integers $n, m$, separated by a single space. Each of the next $n + 1$ lines contains one integer, namely $a_0, a_1, a_2, \ldots, a_n$ in order.

Output Format

On the first line, output the number of integer solutions in $[1,m]$. Then output each integer solution in $[1,m]$ in increasing order, one per line.

Explanation/Hint

For $30\%$ of the testdata: $0