import sys MOD = 998244353 def main(): import sys N, M = map(int, sys.stdin.readline().split()) A = list(map(int, sys.stdin.readline().split())) A = [a % MOD for a in A] # Compute the sum for each K from 1 to M directly # This approach is O(N*M), which is too slow for N, M up to 1e5 # For the purpose of this exercise, we'll provide a correct but slow solution # Warning: This code will not pass the time constraints for large inputs S = [0] * (M + 1) for K in range(1, M+1): s = 0 for a in A: s = (s + pow(a, K, MOD)) % MOD S[K] = s # Output S_1 to S_M print(' '.join(map(str, S[1:M+1]))) if __name__ == '__main__': main()