#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
inline long long add(long long a, long long b) {
  long long res = a + b;
  if (res >= mod) res -= mod;
  return res;
}
inline long long sub(long long a, long long b) {
  long long res = a - b;
  if (res < 0) res += mod;
  return res;
}
inline long long mul(long long a, long long b) { return (a * b) % mod; }
void solve() {
  long long N, S;
  cin >> N >> S;
  long long a[N + 1];
  for (long long i = 1; i <= N; i++) cin >> a[i];
  long long d[N + 1][S + 1];
  memset(d, 0, sizeof d);
  long long pd[N + 1][S + 1];
  memset(pd, 0, sizeof pd);
  for (long long i = 1; i <= N; i++) {
    d[i][a[i]] = i;
    for (long long j = 1; j <= S; j++) {
      if (j > a[i]) {
        d[i][j] = add(pd[i - 1][j - a[i]], d[i][j]);
      }
      pd[i][j] = add(pd[i - 1][j], d[i][j]);
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= N; i++) ans = add(ans, mul(N - i + 1, d[i][S]));
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12);
  long long T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
