#P1158F. Density of subarrays

Density of subarrays

No submission language available for this problem.

Description

Let cc be some positive integer. Let's call an array a1,a2,,ana_1, a_2, \ldots, a_n of positive integers cc-array, if for all ii condition 1aic1 \leq a_i \leq c is satisfied. Let's call cc-array b1,b2,,bkb_1, b_2, \ldots, b_k a subarray of cc-array a1,a2,,ana_1, a_2, \ldots, a_n, if there exists such set of kk indices 1i1<i2<<ikn1 \leq i_1 < i_2 < \ldots < i_k \leq n that bj=aijb_j = a_{i_j} for all 1jk1 \leq j \leq k. Let's define density of cc-array a1,a2,,ana_1, a_2, \ldots, a_n as maximal non-negative integer pp, such that any cc-array, that contains pp numbers is a subarray of a1,a2,,ana_1, a_2, \ldots, a_n.

You are given a number cc and some cc-array a1,a2,,ana_1, a_2, \ldots, a_n. For all 0pn0 \leq p \leq n find the number of sequences of indices 1i1<i2<<ikn1 \leq i_1 < i_2 < \ldots < i_k \leq n for all 1kn1 \leq k \leq n, such that density of array ai1,ai2,,aika_{i_1}, a_{i_2}, \ldots, a_{i_k} is equal to pp. Find these numbers by modulo 998244353998\,244\,353, because they can be too large.

The first line contains two integers nn and cc, separated by spaces (1n,c30001 \leq n, c \leq 3\,000). The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n, separated by spaces (1aic1 \leq a_i \leq c).

Print n+1n + 1 numbers s0,s1,,sns_0, s_1, \ldots, s_n. sps_p should be equal to the number of sequences of indices 1i1<i2<<ikn1 \leq i_1 < i_2 < \ldots < i_k \leq n for all 1kn1 \leq k \leq n by modulo 998244353998\,244\,353, such that the density of array ai1,ai2,,aika_{i_1}, a_{i_2}, \ldots, a_{i_k} is equal to pp.

Input

The first line contains two integers nn and cc, separated by spaces (1n,c30001 \leq n, c \leq 3\,000). The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n, separated by spaces (1aic1 \leq a_i \leq c).

Output

Print n+1n + 1 numbers s0,s1,,sns_0, s_1, \ldots, s_n. sps_p should be equal to the number of sequences of indices 1i1<i2<<ikn1 \leq i_1 < i_2 < \ldots < i_k \leq n for all 1kn1 \leq k \leq n by modulo 998244353998\,244\,353, such that the density of array ai1,ai2,,aika_{i_1}, a_{i_2}, \ldots, a_{i_k} is equal to pp.

Samples

Sample Input 1

4 1
1 1 1 1

Sample Output 1

0 4 6 4 1

Sample Input 2

3 3
1 2 3

Sample Output 2

6 1 0 0

Sample Input 3

5 2
1 2 1 2 1

Sample Output 3

10 17 4 0 0 0

Note

In the first example, it's easy to see that the density of array will always be equal to its length. There exists 44 sequences with one index, 66 with two indices, 44 with three and 11 with four.

In the second example, the only sequence of indices, such that the array will have non-zero density is all indices because in other cases there won't be at least one number from 11 to 33 in the array, so it won't satisfy the condition of density for p1p \geq 1.