#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
inline void read(long long &x) {
  char ch = getchar();
  long long f = 0;
  x = 0;
  while (!isdigit(ch)) {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
  if (f) x = -x;
}
const long long mod = 998244353, N = 3038;
long long n, s, a[N], f[N], res, c[N], mx[N];
signed main() {
  read(n), read(s);
  for (long long i = 1; i <= n; ++i) read(a[i]);
  for (long long i = n; i >= 1; --i) mx[i] = max(mx[i + 1], s - a[i]);
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= max(s, n); ++j) f[j] = c[j] = 0;
    for (long long j = i; j <= n; ++j) {
      f[j] = f[j - 1] + (a[j] == s);
      if (a[j] <= s) f[j] = (f[j] + c[s - a[j]]) % mod;
      for (long long k = mx[j + 1]; k > a[j]; --k) c[k] += c[k - a[j]];
      ++c[a[j]];
      res = (res + f[j]) % mod;
    }
  }
  return printf("%lld\n", res), 0;
}
