#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
#define UNIQ(v) sort(ALL(v)); v.erase(unique(ALL(v)),end(v))
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl

struct BIT {
    vector<ll> data;
    int N;

    BIT(int n) {
        N = n;
        data = vector<ll>(N+1);
    }

    void add(int i, ll x) {
        for (int k = i; k <= N; k += k&-k) data[k] += x;
    }

    ll sum(int i) {
        ll res = 0;
        for (int k = i; k > 0; k -= k&-k) res += data[k];
        return res;
    }
};

const int MAX = 3e5+10;

int N;
int A[MAX];

ll inversion() {
    BIT bit(N);

    ll res = 0;
    for (int i = 0; i < N; i++) {
        res += i-bit.sum(A[i]-1);
        bit.add(A[i], 1);
    }

    return res;
}

int main() {
    cout << fixed << setprecision(15);
    cin >> N;
    REP (i, N) cin >> A[i];
    REP (i, N) A[i]++;

    ll ans = inversion();
    cout << ans << endl;
    REP (i, N-1) {
        ans -= 2*A[i] - N - 1;
        cout << ans << endl;
    }
}

#include<bits/stdc++.h>
using namespace std;
#define MAXN 5005
#define MOD 998244353
#define LL long long int
LL fac[MAXN],rec[MAXN];
LL ans;
int n,m,bitw[MAXN],col[MAXN],bitcnt;
LL dp[5005];
LL qpow(LL a,LL b)
{
    LL res=1;
    while(b)
    {
        if(b&1)res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
void init()
{
    fac[0]=1;
    for(int i=1;i<MAXN;i++)
    fac[i]=fac[i-1]*i%MOD;
    rec[MAXN-1]=qpow(fac[MAXN-1],MOD-2);
    rec[0]=1;
    for(int i=MAXN-2;i>0;i--)
    rec[i]=rec[i+1]*(i+1)%MOD;
}


int main()
{
    ans=0;
    init();
    scanf("%d%d",&n,&m);
    bitcnt=0;
    for(int tm=1;tm<=m;tm<<=1)bitcnt++;
    bitw[bitcnt]=1;
    for(int i=bitcnt-1;i>0;i--)bitw[i]=bitw[i+1]*2;
    int tm=m;
    dp[2]=fac[n]*rec[n-2]%MOD*rec[2]%MOD;
    dp[0]=1;
    dp[1]=0;
    for(int i=3;i<=m;i++)
    {
        if(i%2==1)dp[i]=0;
        else
        for(int j=0;2*j<=i&&2*j<=n;j++)
        {
            dp[i]=(dp[i]+dp[(i-2*j)/2]*fac[n]%MOD*rec[2*j]%MOD*rec[n-2*j])%MOD;
        }
    }
    printf("%lld\n",dp[m]%MOD);
    return 0;
}