#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 100012
#define ll long long
#define int ll
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair
#define f first
#define s second
#define mod 1000000007
ll Mod(ll x, ll y, int p)
{   ll res = 1; x = x % p;
    while (y > 0)
    {   if (y & 1) res = (res * x) % p;
        y = y >> 1; x = (x * x) % p;
    } return res;
}
int* getlps(string pattern) {
    int len = pattern.length();
    int * lps = new int[len];
    lps[0] = 0;
    int i = 1 , j = 0;
    while (i < len) {
        if (pattern[i] == pattern[j]) {
            lps[i] = j + 1;
            i++;
            j++;
        }
        else {
            if (j != 0) {
                j = lps[j - 1];
            }
            else {
                lps[i] = 0;
                i++;
            }
        }
    }
    return lps;
}
class Triplet {
public:
    int x ;
    int y ;
    int gcd;
};
Triplet extendedEuclid(int a , int b) {
    if (b == 0) {Triplet ans; ans.gcd = a; ans.x = 1; ans.y = 0; return ans;}
    Triplet smallAns = extendedEuclid(b , a % b);
    Triplet ans;
    ans.gcd = smallAns.gcd;
    ans.x = smallAns.y;
    ans.y = smallAns.x - (a / b) * smallAns.y;
    return ans;
}
int mmInverse(int a , int m) {
    Triplet ans = extendedEuclid(a , m);
    return (ans.x + m) % m;
}
int fact[N];
void calfac(int n ) {
    fact[0] = 1;
    for (int i = 1 ; i <= n + 2; i++) {
        fact[i] = (((fact[i - 1] % mod) * (i % mod)) % mod + mod) % mod;
    }
}
int calc(int n , int r) {
    if (r > n)return 0;
    if (r == n)return 1;
    int ans = 1;
    ans = ((ans % mod) * (fact[n]) % mod + mod) % mod;
    ans = ((ans % mod) * (mmInverse(fact[n - r] , mod) % mod) + mod) % mod;
    ans = ((ans % mod) * (mmInverse(fact[r] , mod) % mod) + mod) % mod;
    return (ans + mod) % mod;
}


void solve(int cntt) {

    int n;
    int k;
    cin >> n;
    cin >> k;
    int arr[n];
    int dp[n + 1] = {0};
    for (int i = 0 ; i < n ; i++) {
        cin >> arr[i];
        dp[arr[i]]++;
    }
    dp[0] = min(dp[0] , k);
    for (int i = 1 ; i < n ; i++) {
        dp[i] = min(dp[i] , dp[i - 1]);
    }
    int st = dp[0];
    int ans = 0;
    for (int i = 1 ; i < n ; i++) {
        ans += i * (st - dp[i]);
        st = min(st , dp[i]);
    }
    ans += st * (n);
    cout << ans << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    // preprocess();
    int t;
    t = 1;


    int l = 0;
    while (t--) {
        l++;

        solve(l);
    }
    return 0;
}
/* Clearink */

#include <cstdio>

inline void wint ( int x ) {
	if ( 9 < x ) wint ( x / 10 );
	putchar ( x % 10 ^ '0' );
}

const int MAXN = 100;
int N, K, M, f[MAXN + 1][MAXN * ( MAXN / 2 + 1 ) * ( MAXN >> 1 ) / 2 + 5];

inline void addeq ( int& a, const int b ) { ( a += b ) < M ? 0 : a -= M; }

inline void initDP () {
	f[0][0] = 1;
	int sbound = K * ( N / 2 + 1 ) * ( N >> 1 ) >> 1;
	for ( int i = 0; i < N; ++ i ) {
		for ( int j = 0, cur; j <= sbound; ++ j ) {
			if ( !( cur = f[i][j] ) ) continue;
			for ( int k = 0, s = j; k <= K && s <= sbound; ++ k, s += i + 1 ) {
				addeq ( f[i + 1][s], cur );
			}
		}
	}
}

inline int solve ( const int x ) {
	// k[x-1]+2k[x-2]+...+(x-1)k[1] = k[x+1]+2k[x+2]+...+(n-x)k[n].
	int sbound = x - 1 < N - x ? x - 1 : N - x, ret = 0;
	sbound = K * sbound * ( sbound + 1 ) >> 1;
	for ( int s = 0; s <= sbound; ++ s ) {
		addeq ( ret, 1ll * f[x - 1][s] * f[N - x][s] % M );
	}
	return ( ret * ( K + 1ll ) % M + M - 1 ) % M;
}

int main () {
	scanf ( "%d %d %d", &N, &K, &M );
	initDP ();
	for ( int i = 1; i <= N; ++ i ) {
		wint ( solve ( i ) );
		putchar ( '\n' );
	}
	return 0;
}