#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
using namespace std;
#define For(Ti,Ta,Tb) for(int Ti=(Ta);Ti<=(Tb);++Ti)
#define Dec(Ti,Ta,Tb) for(int Ti=(Ta);Ti>=(Tb);--Ti)
template<typename T>
inline bool chkmax(T &i,const T&j){return i<j?(i=j,1):0;}
template<typename T>
inline bool chkmin(T &i,const T&j){return i>j?(i=j,1):0;}
template<typename T> void Read(T &x){
	x=0;int f=1;
	char ch=getchar();
	while(!isdigit(ch)) f=(ch=='-'?-1:f),ch=getchar();
	while(isdigit(ch)) x=x*10+(ch^48),ch=getchar();
	x=x*f;
}
typedef long long ll;
#define INF 0x3f3f3f3f
const int N=2e5+5,Mod=998244353;
int n,len;ll a[N],pw2[N];
pair<ll,int> p[N];
int main(){
	Read(n);For(i,1,n) Read(a[i]);
	pw2[0]=1;For(i,1,n) pw2[i]=pw2[i-1]*2%Mod;
	sort(a+1,a+n+1);
	for(int i=1;i<=n;++i){
		p[++len]=make_pair(a[i],1);
		while(i<=n&&a[i]==a[i+1]) ++p[len].second,++i;
	}
//	For(i,1,len) printf("%lld %d\n",p[i].first,p[i].second);
	ll cur=p[1].first*(pw2[p[1].second]-1)%Mod,ans=0;
	For(i,2,len){
		ans=(ans+cur*p[i].first%Mod*(pw2[p[i].second]-1)%Mod);
		cur=(cur*pw2[p[i].second]%Mod+p[i].first*(pw2[p[i].second]-1)%Mod)%Mod;
	}
	For(i,1,len) ans=(ans+p[i].first*p[i].first%Mod*(pw2[p[i].second]-1)%Mod)%Mod;
	printf("%lld\n",ans);
	return 0;
}

#pragma GCC optimize("O3")   //
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;
typedef unsigned long long ull;


unsigned seed = chrono::system_clock::now().time_since_epoch().count();
mt19937 eng(seed);

ll random2(){
    return (1ll << 31ll)*eng()+eng();
}

ll n,m,k,q,T;

const ll big = 1000000007;
const ll big2 = 1000000009;
const ll mod =  998244353;

const int MAXN = 300001;

int const base = 550000;

int DP[101][base+1] = {0};

void solve(){
    DP[0][0] = 1;
    int ma = 0;
    for(int i = 0; i < n; i++){
        int ma2 = 0;
        for(int sum = 0; sum <= ma; sum++){
            for(int a = 0; a <= k; a++){
                DP[i+1][sum+a*(i+1)] += DP[i][sum];
                if(DP[i+1][sum+a*(i+1)] >= m)DP[i+1][sum+a*(i+1)] -= m;
            }
        }
        ma = ma+k*(i+1);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    //freopen("fhc.txt","r",stdin);
    //freopen("autput.txt","w",stdout);

    ll a,b,c,d,e;

    cin >> n >> k >> m;
    solve();
    rep(x,1,n+1){
        ll temp = 0;
        //cerr << "x: " << x << "\n";
        rep(sum,0,base+1){
            ll thing = (ll(DP[x-1][sum])*ll(DP[n-x][sum]))%m;
            thing *= ll(k+1);
            thing %= m;
            temp += thing;
            if(temp >= m)temp -= m;
         //  if(sum < 10) cerr << ll(DP[x-1][sum]) << " " << DP[n-x][sum] << " " << k << "\n";
        }
        cout << (temp+m-1)%m << "\n";
    }

    return 0;
}
