import sys from collections import defaultdict def main(): N, M, C = map(int, sys.stdin.readline().split()) A = list(map(int, sys.stdin.readline().split())) total_sum = sum(A) # Initialize DP: dp[j] is a dictionary where keys are sums and values are counts mod M dp = [defaultdict(int) for _ in range(C + 1)] dp[0][0] = 1 # Base case: 0 elements selected, sum 0 for a in A: # Process in reverse to avoid overwriting the current state for j in range(C - 1, -1, -1): current_dict = dp[j] next_dict = dp[j + 1] # Iterate over a copy of the keys to avoid modifying the dict during iteration for k in list(current_dict.keys()): count = current_dict[k] new_sum = k + a next_dict[new_sum] = (next_dict[new_sum] + count) % M # Prepare the result for sums from 1 to total_sum result = [0] * (total_sum + 1) for s, cnt in dp[C].items(): if 1 <= s <= total_sum: result[s] = cnt % M # Generate the output string output = [] for s in range(1, total_sum + 1): output.append(str(result[s])) print(' '.join(output)) if __name__ == '__main__': main()