Continue the Sequence

주어진 수열 뒤에 m개 항을 붙여, 완성된 수열을 가장 낮은 차수의 다항식으로 나타낼 수 있게 만든다.

어려움8수학정수론조합론구현아직 제출이 없습니다시간 제한4초메모리 제한256 MB

문제

For sure you have seen puzzles like "Given the sequence, find its next element". They seem logical in your childhood, but later you begin to understand that you can write any number and justify it with some tricky construction.

In this problem you have to continue the sequence "in the easiest way". Still not strict enough? Let us give a formal definition.

Let the hardness of the sequence a_1,a_2,,a_na\_{1}, a\_{2}, \ldots, a\_{n} be the minimum integer dd such that there exists a polynomial pp of degree dd for which p(x)a_x(mod998,244,353)p(x) \equiv a\_{x} \pmod{998\\,244\\,353} for all xx from 11 to nn. For this problem, consider the polynomial p(x)=0p(x) = 0 to have degree 1-1.

Given a sequence a_1,a_2,...,a_na\_{1}, a\_{2}, ..., a\_{n} of size nn, your task is to construct a sequence b_1,b_2,,b_n+mb\_{1}, b\_{2}, \ldots, b\_{n+m} of size n+mn+m such that:

  • 0b_i<998,244,3530 \le b\_{i} < 998\\,244\\,353 for all ii from 11 to n+mn+m,
  • a_i=b_ia\_{i} = b\_{i} for all ii from 11 to nn,
  • The hardness of the sequence bb is as small as possible.

입력

The first line of input contains two integers nn and mm (1n1051 \le n \le 10^{5}, 1m81051 \le m \le 8 \cdot 10^{5}).

The second line of input contains nn integers a_ia\_{i}: the initial sequence (0a_i<998,244,3530 \le a\_{i} < 998\\,244\\,353).

출력

Print mm integers b_n+1,b_n+2,,b_n+mb\_{n+1}, b\_{n+2}, \ldots, b\_{n+m} separated by spaces.

힌트

The notation uv(modp)u \equiv v \pmod{p} means that uu and vv have the same remainder modulo pp.