P5850 calc Enhanced Version.
Background
[Original problem link](https://www.luogu.com.cn/problem/P4463)
Description
A sequence $a_1,\cdots,a_n$ is valid if and only if:
- Its length is the given $n$.
- $a_1,\cdots,a_n$ are all integers in $[1,k]$.
- $a_1,\cdots,a_n$ are pairwise distinct.
The value of a sequence is defined as the product of all numbers in it, i.e., $a_1\times a_2\times\cdots\times a_n$.
Find the sum of the values of all different valid sequences.
Two sequences are different if and only if they differ at any position.
Output the answer modulo $998244353$.
Input Format
One line with two numbers $k,m$.
Output Format
There are $m$ lines in total.
On the $i$-th line $(1\le i\le m)$, output the answer when $n=i$.
Explanation/Hint
$\text{subtask 1 (84 pts)}$:$1\le m\le 500$.
$\text{subtask 2 (16 pts)}$:$1\le m\le 5\times 10^5$,it is recommended to use an efficient output method.
For all testdata, $1\le m\le k\le 998244352$.
Translated by ChatGPT 5