#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
#define check(x) if(x>=mod) x-=mod
const int inf=0x3f3f3f3f,mod=998244353;
const double pi=3.1415926535897932,eps=1e-6;
void chmax(int &x,int y){if(x < y) x = y;}
void chmin(int &x,int y){if(x > y) x = y;}
int qpow(int x,int y){
    int ret = 1;
    while(y) {
        if(y & 1) ret = (ll)ret * x % mod;
        x = (ll)x * x % mod;
        y >>= 1;
    }
    return ret;
}
int n,C[305][305],k,ans[305],a[200005],ab[305][305],suma[305],inv2 = 499122177;
int pwa[200005][305];
int main()
{
    scanf("%d%d",&n,&k);
    C[0][0] = 1;
    rep(i,1,k) rep(j,0,k) {
        C[i][j] = C[i-1][j];
        if(j) {C[i][j] += C[i-1][j-1]; check(C[i][j]);}
    }
    rep(i,1,n) scanf("%d",a+i);
    rep(i,1,n) {
        pwa[i][0] = 1;suma[0] += pwa[i][0];
        rep(j,1,k) {
            pwa[i][j] = (ll)pwa[i][j-1] * a[i] % mod;
            suma[j] += pwa[i][j];
            check(suma[j]);
        }
    }
    rep(i,0,k) rep(j,0,k - i) {
        ab[i][j] = ((ll)suma[i] * suma[j] % mod - suma[i + j] + mod) % mod;
        ab[i][j] = (ll)ab[i][j] * inv2 % mod;
        ans[i + j] += (ll)C[i + j][j] * ab[i][j] % mod;
        check(ans[i + j]);
    }
    rep(i,1,k) printf("%d\n",ans[i]);
    return 0;
}
/*

    P_r_A_d_Y ☹

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

#define int     long long int
#define endl    "\n"
#define mod     1000000007
#define inf     1e18
#define pb      push_back
#define all(x)  x.begin(),x.end()
#define arr_max(x)  *max_element(x.begin(),x.end())
#define arr_min(x)  *min_element(x.begin(),x.end())
#define pii         pair<int,int>
#define ff          first
#define ss          second
#define vec         vector<int>

const int N = 300005;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);


bool cmp(vector<int>a , vector<int>b) {
    return a[0] < b[0];
}
int poww(int x, int n)
{
    if (n == 0 ) return 1 ;
    int u = poww(x, n / 2);
    u = (u * u) ;
    if (n % 2 == 1)u = (u * x) ;
    return u;
}

//(x**n)%m
int mod_pow(int x, int n, int m)
{
    if (n == 0 ) return 1 % m;
    int u = mod_pow(x, n / 2, m);
    u = (u * u) % m;
    if (n % 2 == 1)u = (u * x) % m;
    return u;
}
int query(int l, int r)
{
    int x;
    cout << "? " << l << " " << r << endl;
    cin >> x;

    return x;
}

// int xd[4] = {1, 0, -1, 0};
// int yd[4] = {0, -1, 0, 1};

int32_t main()
{
    fastIO;

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif


    int t;
    t = 1;
    //cin >> t;
    int ert = 1;
    while (t--)
    {
        string s; cin >> s;
        map<char, int>mp;
        int n = s.length();

        int ans = 0;
        for (int i = n - 1; i >= 0; i--)
        {
            if (i + 1 < n && i - 1 >= 0 && s[i] == s[i - 1] && s[i] != s[i + 1])
            {
                int g = n - 1 - i;
                // cout << g << endl;
                if (mp.count(s[i]))
                    g -= mp[s[i]];

                ans += g;

                mp.clear();
                mp[s[i]] = n - 1 - i;
                s[i + 1] = s[i];
            }
            mp[s[i]]++;
        }

        cout << ans << endl;

    }

    return 0;
}