n, M, C = map(int, input().split()) A = list(map(int, input().split())) sumA = sum(A) if C == 0: print(' '.join(['0'] * sumA)) exit() # Initialize DP and max_s arrays dp = [[0] * (sumA + 1) for _ in range(C + 1)] dp[0][0] = 1 max_s = [0] * (C + 1) for a in A: # Iterate from C down to 1 to avoid overwriting data we need to read for c in range(C, 0, -1): prev_c = c - 1 prev_max = max_s[prev_c] if prev_max == 0 and dp[prev_c][0] == 0: continue # Skip if no previous entries new_max = max(max_s[c], prev_max + a) current_dp = dp[c] prev_dp = dp[prev_c] for s in range(prev_max + 1): if prev_dp[s]: new_s = s + a current_dp[new_s] = (current_dp[new_s] + prev_dp[s]) % M max_s[c] = new_max # Prepare the result result = [] for s in range(1, sumA + 1): result.append(str(dp[C][s] % M)) print(' '.join(result))