#include <bits/stdc++.h>
using namespace std;
const int Mod = 998244353;
int add(int a, int b) { return a + b >= Mod ? a + b - Mod : a + b; }
int dec(int a, int b) { return a - b < 0 ? a - b + Mod : a - b; }
int mul(int a, int b) { return 1ll * a * b % Mod; }
void Add(int &a, int b) { a = add(a, b); }
void Dec(int &a, int b) { a = dec(a, b); }
void Mul(int &a, int b) { a = mul(a, b); }
int ksm(int a, int b) {
  int ans = 1;
  for (; b; b >>= 1, Mul(a, a))
    if (b & 1) Mul(ans, a);
  return ans;
}
const int N = 3e3 + 50, M = 1 << 12;
int n, m, a[N], ans[N], pw[N];
void work() {
  int U = 1 << m;
  static int dp[M][N];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int S = U - 1, c; ~S; S--)
      for (int j = 0; j <= i / m; j++)
        if (c = dp[S][j]) Add(dp[S | (1 << a[i] - 1)][j], c);
    for (int j = 0; j <= i / m; j++)
      Add(dp[0][j + 1], dp[U - 1][j]), dp[U - 1][j] = 0;
  }
  for (int S = 0; S + 1 < U; S++)
    for (int j = 0; j <= n / m; j++) Add(ans[j], dp[S][j]);
  Dec(ans[0], 1);
  for (int i = 0; i <= n; i++) cout << ans[i] << " ";
}
struct lll {
  int x, y;
  lll(int _x = 0, int _y = 1) { x = _x, y = _y; }
  void operator*=(const int &z) {
    if (z)
      Mul(y, z);
    else
      ++x;
  }
  lll operator/(const int &z) {
    if (z)
      Mul(y, ksm(z, Mod - 2));
    else
      --x;
    return *this;
  }
  operator int() const { return x > 0 ? 0 : y; }
};
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  static int dp[N][N];
  dp[n + 1][0] = 1;
  for (int i = n; i; i--) {
    static int c[N], ct[N], v[N];
    memset(ct, 0, sizeof(ct));
    memset(c, 0, sizeof(c));
    memset(v, 0, sizeof(v));
    lll t(m - 1, 1);
    for (int j = i + 1, x; j < n; j++) {
      x = a[j], t = t / v[x], ++ct[x];
      v[x] = ksm(2, ct[x]) - (a[j] != a[i]);
      t *= v[x], c[j + 1] = t / v[a[j + 1]];
      if (a[i] == a[j + 1]) c[j + 1] = 0;
    }
    int lm = (n - i + 1) / m;
    for (int j = 1; j <= lm; j++)
      for (int k = i; k <= n; k++)
        if (c[k]) Add(dp[i][j], mul(dp[k + 1][j - 1], c[k]));
    dp[i][0] = ksm(2, n - i);
    for (int j = 0; j <= lm; j++) Add(dp[i][j], dp[i + 1][j]);
  }
  Dec(dp[1][0], 1);
  for (int j = 0; j <= n; j++) cout << dec(dp[1][j], dp[1][j + 1]) << " ";
  return 0;
}
