import sys def main(): input = sys.stdin.read().split() idx = 0 N = int(input[idx]); idx +=1 M = int(input[idx]); idx +=1 C = int(input[idx]); idx +=1 A = list(map(int, input[idx:idx+N])) total = sum(A) # Initialize DP table with two layers to save memory dp = [[0] * (total + 1) for _ in range(C + 1)] dp[0][0] = 1 % M for a in A: # Iterate c from C down to 1 to avoid overwriting data we still need to process for c in range(C, 0, -1): # Iterate s from total down to a to ensure we don't reuse the same element multiple times in the same step for s in range(total, a - 1, -1): if dp[c - 1][s - a]: dp[c][s] = (dp[c][s] + dp[c - 1][s - a]) % M result = [] for s in range(1, total + 1): result.append(str(dp[C][s] % M)) print(' '.join(result)) if __name__ == '__main__': main()